Maintaining a bank account

In this exercise you will write a program to maintain a bank account balance.

Your program will first describe itself, then ask the user to enter an initial balance (use a method to do this).

Then the program should display a menu of options and ask the user (repeatedly) to enter a transaction type:

What would you like to do? 
1 - deposit
2 - withdrawal
3 - balance inquiry
4 - quit
If the user enters anything else than 1,2,3,4 the program should print:
This is not a valid option. Try again. 
What would you like to do? 
1 - deposit
2 - withdrawal
3 - balance inquiry
4 - quit

If the user presses 1, the program should call a method that performs a deposit. This method will ask the user for the deposit amount and return this value. The program should use this value to update the current value of the balance.

If the user presses 2, the program should call a method that performs an withdrawal. This method will ask the user for the withdrawal amount and return this value. The program should use this value to update the current value of the balance.

If the user presses 3, the progam should call a method to display the current balance.

If the user presses 4, the program should print the final balance, say Good Bye, and quit. Otherwise it should go back to asking the user to enter a transaction type.

This is it. Go back, read it all over again, and make sure you understand what your program should do.

Now, you'll need to write your program using methods. Methods encapsulate logical units of code. Of course, the meaning of logical may vary a bit from one logical person to another. For this exercise you will have to design your methods and structure your program so that the it looks as follows:

public static void  main( String []) {

   int option = 0; //some dummy initial value

   //this variable holds the account balance
   double balance;  

   //describe program to user
   describeProgram(); 

   //ask for initial balance; 
   balance = getInitialBalance(); 

   while (option != 4) {

      //this function should make sure the option is valid
      option = getOption();
      
      if (option == 1) {...};
      if (option == 2) {...};
      if (option == 3) {...};
      if (option == 4) {...};
    }
} //end of main
To start this program, think what functions do you need to write, and what are their arguments? Note that I am not giving you the exact form of the methods, you will have to come up with it.

I suggest you start top-down, by writing the main() method, and the while loop that reads user options. And then add one method at a time, compile it, and check that it works.