Discussion group, leave your messages |
|
Implement a simulation to a Bank system (expanded version) In this assignment you will implement a small bank simulation program, using the control structures if, while loop, switch to ensure that no money is overdrawn beyond what is available for a particular customer (now, customer is an object) also avoid improper deposits. Also there will be a menu system so that the user can go back to the menu after each transaction. You will implement the Myinput class. (see it below) Details: You will have two customer objects, its properties will be Account#, Name, Balance. You will have methods (queries) to ask for name, balance, account and other methods that you will see fit for the class Customer. You will have a class Banking to implement the features for deposit, withdraw, etc. You will also have the Driver that will start your program and contain the main menu for the operations. You can even add another called Bank_control where you would have the menu system and the Driver that would be just to start the program and create the object bank. Suppose that each customer start with $1000 to start with. You will go through the process of depositing and withdrawing money and requesting for the current balance. The difference now is that you will have a menu to interact with it. The bank will only stop when user decide to select exit bank. The menu would be similar to this: Welcome to Bank X 1) If you want to perform operations for John Doe 2) If you want to perform operations for Mary Lu 3) Exit bank system
If 1 is chosen Welcome John Doe 1) Deposit 2) Withdraw 3) Balance
You will keep track of the balance until menu exits out of the system. Any questions, let instructor know. Make sure to show assignment to instructor prior to turn it in. Make sure to test software. TURN IN: Place it all in a large envelope · A hard copy of your program, well documented with precondition and postconditions · A copy of your project on the floppy disk · A copy of the DOC document · A hard copy of a sample output =============================================================== // MyInput.java: Contain the methods for reading int, double, and // string values from the keyboard import java.io.*; public class MyInput { // Read a string from the keyboard public static String readString() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 1); // Declare and initialize the string String string = ""; // Get the string from the keyboard try { string = br.readLine(); } catch (IOException ex) { System.out.println(ex); } // Return the string obtained from the keyboard return string; } // Read an int value from the keyboard public static int readInt() { return Integer.parseInt(readString()); } // Read a double value from the keyboard public static double readDouble() { return Double.parseDouble(readString()); } // Read a byte value from the keyboard public static byte readByte() { return Byte.parseByte(readString()); } // Read a short value from the keyboard public static short readShort() { return Short.parseShort(readString()); } // Read a long value from the keyboard public static long readLong() { return Long.parseLong(readString()); } // Read a float value from the keyboard public static float readFloat() { return Float.parseFloat(readString()); } } A sample data input from method readString from class MyInput: // 1. Enter name
|
Back to
CS161 JAVA Homepage |