Tell me if this makes sense structurally. I have a final this week and this homework will not be graded till after the final. I was just curious if I have as firm a grasp on this as I think I do.

public class account {
	private int id = 0;
	
	private double balance = 0;
	
	private double annualInterestRate = 0;
	
	java.util.Date dateCreated = new java.util.Date();
	
	public account(){
		int defaultAccount = 0;
 	}
	
	public account(int setId, int intialBalance){
		id = setId;
		balance = intialBalance;
	}
	
	public return getMonthlyInterestRate(annualInterestrate){
		monthlyinterestrate =annualInterestRate/12;
		return monthlyInterestRate;
	}
	
	public return withdraw(balance, withdrawlAmount){
		balance = balance - withdrawlAmount;
		return balance;
	}
	
	public return deposit(balance, depositAmount){
		balance = balance + depositAmount;
		return balance;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int id = 1122;
		double balance = 20000;
		double annualInterestRate = 4.5;
		double withdrawlAmount = 2500;
		double depositAmount = 3000;
		System.out.println("The balance after withdrawing $2500 is $"+ withdraw(balance,withdrawlAmount));
		System.out.println("The balance after depositing $3000 is $"+ deposit(balance,depositAmount));
		System.out.println("The monthly interest rate is "+getMonthlyInterestRate(annualInterestRate)+"%.");
		System.out.println("The date the account was created is"+dateCreated+".");
	}

}

the syntax for the following methods is not coorect:

public return getMonthlyInterestRate(annualInterestrate)
public return withdraw(balance, withdrawlAmount)
public return deposit(balance, depositAmount)

The Correct syntax is

public double getMonthlyInterestRate(double annualInterestrate)
public double withdraw(double balance, double withdrawlAmount)
public double deposit(double balance, double depositAmount)

The syntax of Java methods is

<scope> <return type> <method name> (<parameters>)

Where the parameters are optional and if there is no return type it should be written as "void". Since your methods return double, the return type should be double. Also, in the method declaration, you have to define the type of each parameter, therefore you need to define "double balance" and not just "balance" - the compiler needs to know what type of variable is balance.

Thank you apines, that is exactly what I didn't know that I didn't understand.

This question has already been answered. Start a new discussion instead.