Jump to content
The mkiv Supra Owners Club

Anyone any good with Java?


Robert

Recommended Posts

here the full outline of whats needed:

 

Write a program which implements classes Bank (abstract class), SavingsAccount, CheckingAccount

with appropriate methods. When the user opens an account, the program will ask whether it is

a checking account or a savings account. The user will enter either c or s to indicate a choice.

If the user enters s, the program will ask for the annual interest for that account.

The program should support commands for opening an account, selecting an existing account,

depositing to an account, withdrawing from an account, closing an account. The commands can

be given by the user, in response to a displayed text based menu, until the user selects to exit

the command menu by pressing q (quit).

The program should have two additional commands: r (write a check) and i (credit interest).

The r command is similar to the withdraw command, except that it increments the number of

checks written on the account. If the current account is not a checking account, the program

should display the following message:

Please select a checking account

The i command credits one month of interest to each savings account, based on the interest

rate for that account (checking accounts are not affected).

The program should display information about the currently selected account, such as its

number, its balance, the number of checks currently written for it (for a checking account) and

its interest rate (for a savings account).

Additionally, the user should be able to display all the accounts in descending order, according

to their balances. I.e. the account with the greatest balance should be displayed first, the

account with the second greatest balance should be displayed next, etc.

Implement a test class which creates instances of all the implemented classes and tests their

functionality.

Link to comment
Share on other sites

hey I know Java like the back of my hand (along with C/C++/C#/VB) so I can help.

 

but if you can be more specific with a particular problem, I 've not got the time to write the program for you I'm afraid.

 

I did a post grad level 4 Java course with the OU, it was good

Link to comment
Share on other sites

ive written the code for the bank account,checking account,savings account and the tester, just need help with the I/O part

 

This sort of thing should cover you for rough-and-ready text entry menu system.

 

public static void main(String[] args) {

mainMenu();

}

 

private static void mainMenu() {

System.out.println("MAIN MENU");

System.out.println("1 - Option 1");

System.out.println("2 - Option 2");

System.out.println("Q - Quit");

String command = getInputCommand();

if (command.equalsIgnoreCase("1")) {

option1method();

} else if (command.equalsIgnoreCase("2")) {

option2method();

} else if (command.equalsIgnoreCase("q")) {

System.exit(1);

}

 

private static String getInputCommand() {

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

String command = null;

try {

command = br.readLine();

} catch (IOException ioe) {

System.out.println("Data Entry Failure");

System.exit(1);

}

return command;

}

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. You might also be interested in our Guidelines, Privacy Policy and Terms of Use.