Hello guys ..
first this is part of my code.. there are few mistakes and missing stuff but i am still working on it
private static boolean isNowOverdrawn() { if ( dollars < 0 ) { return true; } else { return false; } } private static void deposit(double amount) { dollars += amount; // check to see if not overdrawn and update isNowOverdrawn variable JOptionPane.showInputDialog("Enter amount: $"); if( amount < 0 ) { JOptionPane.showMessageDialog(null, "It's overdrawn"); } else { return; // here I want to update the balance } }
the question is ..
- A void method called deposit that takes a double amount as a parameter. This amount will be added to the dollars in the account (and could of course influence whether it is now overdrawn or not).
- A Boolean method called isNowOverdrawn (with no parameters to it) that returns a true if the account is currently overdrawn and a false otherwise.
- A double returning method called balance (with no parameters to it) that returns the dollars now in the account.
I am a beginner programmer so please be patient with me ^^ ..
my Question is :
How can I refer one method to another ?
to clarify .. when I deposit money I have to check if it's overdrawn or not ? and then update the overdrawn .. ??
the deposit is method and the overdrawn is another one .. when I write ( return overdrawn ) i've error message said ( void method can not be return to void method )
anyone has a clue .. could help ..
Thanks