Member Avatar for Corrderio

So I've recently been learning java and have been using www.javacoffeebreak.com for my first tutorial, anyway everything's been going smoothly til I get to here: http://javacoffeebreak.com/java102/java102.html

The code that's giving me that error is the following:

public class Account 
{
        protected double balance;

        // Constructor to initialize balance
        public Account( double amount )
	{
		balance = amount;
	}

        // Overloaded constructor for empty balance
        public Account()
	{
		balance = 0.0;
	}

        public void deposit( double amount )
	{
		balance += amount;
	}

        public double withdraw( double amount )
	{
                // See if amount can be withdrawn
		if (balance >= amount)
		{
			balance -= amount;
                        return amount;
		}
		else
                // Withdrawal not allowed
                        return 0.0;
	}

        public double getbalance()
	{
                return balance;
	}
}

Anyone see what I'm doing wrong? Thanks in advance.

Yes, you are supposed to follow the tutorial till the end and execute AccountDemo.java and not just Account.java.
Account class is just sort of storage design to hold data associated with accounting. This class normally provide some constructors to create object in the memory, some setter and getters to provide wait to manipulate variables used by the object, and more often some methods that are associated in some way with account object like in this case make deposit, withdraw and get balance.

Member Avatar for Corrderio

Ahh I see, thanks. I'm usually use to tutorials giving out very simple code like I posted above, then afterwards having you expand on the code if it works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.