alfa147x
Lifer
im trying to compile this script:
import java.util.Random;
public class BankAccount
{
private double balance;
//Make tank
public tank();
{
balance = 0;
//consturct
}
//deposite
public void deposit(double amount)
{
double newBalance = balance + amount;
balance = newBalance;
}
//Take out
public void withdraw(double amount)
{
double newBalance = balance - amount;
balance = newBalance;
}
//Get balance
public double getBalance()
{
return balance;
}
}
I get this error:
BankAccount.java:14: invalid method declaration; return type required
public tank();
^
1 error
Press any key to continue . . .
import java.util.Random;
public class BankAccount
{
private double balance;
//Make tank
public tank();
{
balance = 0;
//consturct
}
//deposite
public void deposit(double amount)
{
double newBalance = balance + amount;
balance = newBalance;
}
//Take out
public void withdraw(double amount)
{
double newBalance = balance - amount;
balance = newBalance;
}
//Get balance
public double getBalance()
{
return balance;
}
}
I get this error:
BankAccount.java:14: invalid method declaration; return type required
public tank();
^
1 error
Press any key to continue . . .