In this assignment, you will create a Java program to read bank accounts, including checking and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this assignment, you will create a Java program to read bank accounts, including checking and savings accounts, from an input file, and write them in reverse order to an output file. 1. The input file name and the output file name are passed in as the first and second arguments at command line, respectively. For example, assume your package name is FuCIS265 and your main class name is FuAssignment4, and your executable files are in "C:\Users\2734848\eclipse-workspace CIS 265 Assignments\bin". The following command line will read from a local file "accounts.txt" and write to a local file "accounts_reversed.txt": C:\Users\2734848\eclipse-workspace CIS 265 Assignments \bin > java FUCIS265. FuAssignment4 accounts.txt accounts_reversed.txt You need to specify the command line arguments if you use an IDE such as jGrasp or Eclipes. The parameter String[] args in the main method contains the command line arguments, where args[0] contains the first argument. For example, in the previous command, args[0] contains accounts.txt, and args [1] contains accounts_reversed.txt. 4. If the program is run with incorrect number of arguments, your program must print an error message and exit. The error message must show correct format to run your program, e.g., "Usage: FUCIS265.FuAssignment4 input file output_file" where FuCIS265 is the package and FuAssignment4 is the main class. 2. 3. 5. Each line in the input file represents an account. There are 5 fields in each line: owner, number, balance, type (checking or savings), checkLimit or interest. The fields are separated by comma, ",". For example, th input file accounts.txt file may contain: James Bond, 200304, 1000. 33, checking, 20 Michelle Wang, 200224, 3333.3, savings, 0.5 Tayer Smith, 249843, 132.87, checking, 25 David Jess, 265334, 225.7, checking, 30 6. The program will read the lines and create checking or savings accounts accordingly. The accounts are stored in an ArrayList. 7. The program then writes the list of accounts in reserve order to the output file. 8. The program prints "Bye!" when it is done. 9. Given the previous input file accounts.txt, the output file, accounts reserved.txt, will be: David Jess, 265334, 225.7, checking, 30 Tayer Smith, 249843, 132.87, checking, 25 Michelle Wang, 200224, 3333.3, savings, 0.5 James Bond, 200304, 1000. 33, checking, 20 II. Implementation Requirements The program must implement a main class and three bank account classes (BankAccount, CheckingAccount, Savings Acount) which are specified in the following UML class diagram. The changes from previous assignments are shown in red. -owner: String -number: int BankAccount -balance: double +Bank Account() +Bank Account(String, int, double) +printBank Account():void +getNumber(): int +printBank Account(Print Writer pw):void CheckingAccount Savings Account -interest: double + Savings Account () + Savings Account (String, int, double, double) +printBankAccount():void -checkLimit: int +Checking Account() +Checking Account (String, int, double, int) +printBankAccount():void +printBankAccount(PrintWriter pw):void +printBank Account(Print Writer pw):void All classes must be in the same package. The package name must start with your last name. For example, if your last name is "Biden", your package name must start with "Biden" such as "BidenCIS265", "BidenData Structures", etc. • You main class file name must start with your last name. For example, if your last name is "Spiderman", your main class file name must start with "Spiderman" such as "Spiderman4.java", "SpidermanAssign4.java", etc. • The Bank Account class must be abstract and have a no-arg constructor, and a constructor with 3 parameters: a String, an int, and a double. It must have a method printBank Account() to print its owner, number, and balance. It must have a method getNumber() which returns its number. It also must have a method printBankAccount(Print Writer pw) that writes the account's owner, number, and balance to the file. • The Checking Account class must extends the BankAccount class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and an int. The constructor with parameters must call the Bank Account's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and checkLimit. It must also override the printBank Account(Print Writer pw) method to write its owner, number, balance, and checkLimit to the file. • The Savings Account class must extends the Bank Account class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and a double. The constructor with parameters must call the BankAccount's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and interest. It must also override the printBankAccount(Print Writer pw) method to write its owner, number, balance, and interest to the file. • Since I/O exceptions are checked exceptions, your main class must handle exceptions. You may use the try/catch or throw IOException. To throw exceptions, you declare it as: public static void main(String[] args) throws IOException • You may reuse the code from previous assignments. However, please not the changes to the bank account classes. • Your program must close both input and output files after they are done, unless they are put in the try-with- resource block. • You can assume that input file has the correct format. You will earn bonus points for handling incorrect input formats. III. Submission This is an individual assignment. Each student needs to submit the source code files of the Java program on Blackboard. In this assignment, you will create a Java program to read bank accounts, including checking and savings accounts, from an input file, and write them in reverse order to an output file. 1. The input file name and the output file name are passed in as the first and second arguments at command line, respectively. For example, assume your package name is FuCIS265 and your main class name is FuAssignment4, and your executable files are in "C:\Users\2734848\eclipse-workspace CIS 265 Assignments\bin". The following command line will read from a local file "accounts.txt" and write to a local file "accounts_reversed.txt": C:\Users\2734848\eclipse-workspace CIS 265 Assignments \bin > java FUCIS265. FuAssignment4 accounts.txt accounts_reversed.txt You need to specify the command line arguments if you use an IDE such as jGrasp or Eclipes. The parameter String[] args in the main method contains the command line arguments, where args[0] contains the first argument. For example, in the previous command, args[0] contains accounts.txt, and args[1] contains accounts_reversed.txt. 4. If the program is run with incorrect number of arguments, your program must print an error message and exit. The error message must show correct format to run your program, e.g., "Usage: FUCIS265.FuAssignment4 input file output_file" where FuCIS265 is the package and FuAssignment4 is the main class. 2. 3. 5. Each line in the input file represents an account. There are 5 fields in each line: owner, number, balance, type (checking or savings), checkLimit or interest. The fields are separated by comma, ",". For example, th input file accounts.txt file may contain: James Bond, 200304, 1000. 33, checking, 20 Michelle Wang, 200224, 3333.3, savings, 0.5 Tayer Smith, 249843, 132.87, checking, 25 David Jess, 265334, 225.7, checking, 30 6. The program will read the lines and create checking or savings accounts accordingly. The accounts are stored in an ArrayList. 7. The program then writes the list of accounts in reserve order to the output file. 8. The program prints "Bye!" when it is done. 9. Given the previous input file accounts.txt, the output file, accounts reserved.txt, will be: David Jess, 265334, 225.7, checking, 30 Tayer Smith, 249843, 132.87, checking, 25 Michelle Wang, 200224, 3333.3, savings, 0.5 James Bond, 200304, 1000. 33, checking, 20 II. Implementation Requirements The program must implement a main class and three bank account classes (BankAccount, CheckingAccount, Savings Acount) which are specified in the following UML class diagram. The changes from previous assignments are shown in red. -owner: String -number: int BankAccount -balance: double +Bank Account() +Bank Account(String, int, double) +printBank Account():void +getNumber(): int +printBank Account(PrintWriter pw):void CheckingAccount -checkLimit: int +Checking Account() +Checking Account (String, int, double, int) +printBankAccount():void +printBankAccount(Print Writer pw):void Savings Account -interest: double + Savings Account () + Savings Account (String, int, double, double) +printBankAccount():void +printBank Account(Print Writer pw):void All classes must be in the same package. The package name must start with your last name. For example, if your last name is "Biden", your package name must start with "Biden" such as "BidenCIS265", "BidenData Structures", etc. • You main class file name must start with your last name. For example, if your last name is "Spiderman", your main class file name must start with "Spiderman" such as "Spiderman4.java", "SpidermanAssign4.java", etc. • The Bank Account class must be abstract and have a no-arg constructor, and a constructor with 3 parameters: a String, an int, and a double. It must have a method printBank Account() to print its owner, number, and balance. It must have a method getNumber() which returns its number. It also must have a method printBankAccount(Print Writer pw) that writes the account's owner, number, and balance to the file. • The Checking Account class must extends the BankAccount class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and an int. The constructor with parameters must call the Bank Account's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and checkLimit. It must also override the printBank Account(Print Writer pw) method to write its owner, number, balance, and checkLimit to the file. • The Savings Account class must extends the Bank Account class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and a double. The constructor with parameters must call the BankAccount's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and interest. It must also override the printBankAccount(Print Writer pw) method to write its owner, number, balance, and interest to the file. • Since I/O exceptions are checked exceptions, your main class must handle exceptions. You may use the try/catch or throw IOException. To throw exceptions, you declare it as: public static void main(String[] args) throws IOException • You may reuse the code from previous assignments. However, please not the changes to the bank account classes. • Your program must close both input and output files after they are done, unless they are put in the try-with- resource block. • You can assume that input file has the correct format. You will earn bonus points for handling incorrect input formats. III. Submission This is an individual assignment. Each student needs to submit the source code files of the Java program on Blackboard. In this assignment, you will create a Java program to read bank accounts, including checking and savings accounts, from an input file, and write them in reverse order to an output file. 1. The input file name and the output file name are passed in as the first and second arguments at command line, respectively. For example, assume your package name is FuCIS265 and your main class name is FuAssignment4, and your executable files are in "C:\Users\2734848\eclipse-workspace CIS 265 Assignments\bin". The following command line will read from a local file "accounts.txt" and write to a local file "accounts_reversed.txt": C:\Users\2734848\eclipse-workspace CIS 265 Assignments \bin > java FUCIS265. FuAssignment4 accounts.txt accounts_reversed.txt You need to specify the command line arguments if you use an IDE such as jGrasp or Eclipes. The parameter String[] args in the main method contains the command line arguments, where args[0] contains the first argument. For example, in the previous command, args[0] contains accounts.txt, and args [1] contains accounts_reversed.txt. 4. If the program is run with incorrect number of arguments, your program must print an error message and exit. The error message must show correct format to run your program, e.g., "Usage: FUCIS265.FuAssignment4 input file output_file" where FuCIS265 is the package and FuAssignment4 is the main class. 2. 3. 5. Each line in the input file represents an account. There are 5 fields in each line: owner, number, balance, type (checking or savings), checkLimit or interest. The fields are separated by comma, ",". For example, th input file accounts.txt file may contain: James Bond, 200304, 1000. 33, checking, 20 Michelle Wang, 200224, 3333.3, savings, 0.5 Tayer Smith, 249843, 132.87, checking, 25 David Jess, 265334, 225.7, checking, 30 6. The program will read the lines and create checking or savings accounts accordingly. The accounts are stored in an ArrayList. 7. The program then writes the list of accounts in reserve order to the output file. 8. The program prints "Bye!" when it is done. 9. Given the previous input file accounts.txt, the output file, accounts reserved.txt, will be: David Jess, 265334, 225.7, checking, 30 Tayer Smith, 249843, 132.87, checking, 25 Michelle Wang, 200224, 3333.3, savings, 0.5 James Bond, 200304, 1000. 33, checking, 20 II. Implementation Requirements The program must implement a main class and three bank account classes (BankAccount, CheckingAccount, Savings Acount) which are specified in the following UML class diagram. The changes from previous assignments are shown in red. -owner: String -number: int BankAccount -balance: double +Bank Account() +Bank Account(String, int, double) +printBank Account():void +getNumber(): int +printBank Account(PrintWriter pw):void CheckingAccount Savings Account -interest: double + Savings Account () + Savings Account (String, int, double, double) +printBankAccount():void -checkLimit: int +Checking Account() +Checking Account (String, int, double, int) +printBankAccount():void +printBankAccount(PrintWriter pw):void +printBank Account(Print Writer pw):void All classes must be in the same package. The package name must start with your last name. For example, if your last name is "Biden", your package name must start with "Biden" such as "BidenCIS265", "BidenData Structures", etc. • You main class file name must start with your last name. For example, if your last name is "Spiderman", your main class file name must start with "Spiderman" such as "Spiderman4.java", "SpidermanAssign4.java", etc. • The Bank Account class must be abstract and have a no-arg constructor, and a constructor with 3 parameters: a String, an int, and a double. It must have a method printBank Account() to print its owner, number, and balance. It must have a method getNumber() which returns its number. It also must have a method printBankAccount(Print Writer pw) that writes the account's owner, number, and balance to the file. • The Checking Account class must extends the BankAccount class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and an int. The constructor with parameters must call the Bank Account's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and checkLimit. It must also override the printBank Account(Print Writer pw) method to write its owner, number, balance, and checkLimit to the file. • The Savings Account class must extends the Bank Account class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and a double. The constructor with parameters must call the BankAccount's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and interest. It must also override the printBankAccount(Print Writer pw) method to write its owner, number, balance, and interest to the file. • Since I/O exceptions are checked exceptions, your main class must handle exceptions. You may use the try/catch or throw IOException. To throw exceptions, you declare it as: public static void main(String[] args) throws IOException • You may reuse the code from previous assignments. However, please not the changes to the bank account classes. • Your program must close both input and output files after they are done, unless they are put in the try-with- resource block. • You can assume that input file has the correct format. You will earn bonus points for handling incorrect input formats. III. Submission This is an individual assignment. Each student needs to submit the source code files of the Java program on Blackboard. In this assignment, you will create a Java program to read bank accounts, including checking and savings accounts, from an input file, and write them in reverse order to an output file. 1. The input file name and the output file name are passed in as the first and second arguments at command line, respectively. For example, assume your package name is FuCIS265 and your main class name is FuAssignment4, and your executable files are in "C:\Users\2734848\eclipse-workspace CIS 265 Assignments\bin". The following command line will read from a local file "accounts.txt" and write to a local file "accounts_reversed.txt": C:\Users\2734848\eclipse-workspace CIS 265 Assignments \bin > java FUCIS265. FuAssignment4 accounts.txt accounts_reversed.txt You need to specify the command line arguments if you use an IDE such as jGrasp or Eclipes. The parameter String[] args in the main method contains the command line arguments, where args[0] contains the first argument. For example, in the previous command, args[0] contains accounts.txt, and args [1] contains accounts_reversed.txt. 4. If the program is run with incorrect number of arguments, your program must print an error message and exit. The error message must show correct format to run your program, e.g., "Usage: FUCIS265.FuAssignment4 input file output_file" where FuCIS265 is the package and FuAssignment4 is the main class. 2. 3. 5. Each line in the input file represents an account. There are 5 fields in each line: owner, number, balance, type (checking or savings), checkLimit or interest. The fields are separated by comma, ",". For example, th input file accounts.txt file may contain: James Bond, 200304, 1000. 33, checking, 20 Michelle Wang, 200224, 3333.3, savings, 0.5 Tayer Smith, 249843, 132.87, checking, 25 David Jess, 265334, 225.7, checking, 30 6. The program will read the lines and create checking or savings accounts accordingly. The accounts are stored in an ArrayList. 7. The program then writes the list of accounts in reserve order to the output file. 8. The program prints "Bye!" when it is done. 9. Given the previous input file accounts.txt, the output file, accounts reserved.txt, will be: David Jess, 265334, 225.7, checking, 30 Tayer Smith, 249843, 132.87, checking, 25 Michelle Wang, 200224, 3333.3, savings, 0.5 James Bond, 200304, 1000. 33, checking, 20 II. Implementation Requirements The program must implement a main class and three bank account classes (BankAccount, CheckingAccount, Savings Acount) which are specified in the following UML class diagram. The changes from previous assignments are shown in red. -owner: String -number: int BankAccount -balance: double +Bank Account() +Bank Account(String, int, double) +printBank Account():void +getNumber(): int +printBank Account(Print Writer pw):void CheckingAccount Savings Account -interest: double + Savings Account () + Savings Account (String, int, double, double) +printBankAccount():void -checkLimit: int +Checking Account() +Checking Account (String, int, double, int) +printBankAccount():void +printBankAccount(PrintWriter pw):void +printBank Account(Print Writer pw):void All classes must be in the same package. The package name must start with your last name. For example, if your last name is "Biden", your package name must start with "Biden" such as "BidenCIS265", "BidenData Structures", etc. • You main class file name must start with your last name. For example, if your last name is "Spiderman", your main class file name must start with "Spiderman" such as "Spiderman4.java", "SpidermanAssign4.java", etc. • The Bank Account class must be abstract and have a no-arg constructor, and a constructor with 3 parameters: a String, an int, and a double. It must have a method printBank Account() to print its owner, number, and balance. It must have a method getNumber() which returns its number. It also must have a method printBankAccount(Print Writer pw) that writes the account's owner, number, and balance to the file. • The Checking Account class must extends the BankAccount class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and an int. The constructor with parameters must call the Bank Account's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and checkLimit. It must also override the printBank Account(Print Writer pw) method to write its owner, number, balance, and checkLimit to the file. • The Savings Account class must extends the Bank Account class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and a double. The constructor with parameters must call the BankAccount's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and interest. It must also override the printBankAccount(Print Writer pw) method to write its owner, number, balance, and interest to the file. • Since I/O exceptions are checked exceptions, your main class must handle exceptions. You may use the try/catch or throw IOException. To throw exceptions, you declare it as: public static void main(String[] args) throws IOException • You may reuse the code from previous assignments. However, please not the changes to the bank account classes. • Your program must close both input and output files after they are done, unless they are put in the try-with- resource block. • You can assume that input file has the correct format. You will earn bonus points for handling incorrect input formats. III. Submission This is an individual assignment. Each student needs to submit the source code files of the Java program on Blackboard. In this assignment, you will create a Java program to read bank accounts, including checking and savings accounts, from an input file, and write them in reverse order to an output file. 1. The input file name and the output file name are passed in as the first and second arguments at command line, respectively. For example, assume your package name is FuCIS265 and your main class name is FuAssignment4, and your executable files are in "C:\Users\2734848\eclipse-workspace CIS 265 Assignments\bin". The following command line will read from a local file "accounts.txt" and write to a local file "accounts_reversed.txt": C:\Users\2734848\eclipse-workspace CIS 265 Assignments \bin > java FUCIS265. FuAssignment4 accounts.txt accounts_reversed.txt You need to specify the command line arguments if you use an IDE such as jGrasp or Eclipes. The parameter String[] args in the main method contains the command line arguments, where args[0] contains the first argument. For example, in the previous command, args[0] contains accounts.txt, and args[1] contains accounts_reversed.txt. 4. If the program is run with incorrect number of arguments, your program must print an error message and exit. The error message must show correct format to run your program, e.g., "Usage: FUCIS265.FuAssignment4 input file output_file" where FuCIS265 is the package and FuAssignment4 is the main class. 2. 3. 5. Each line in the input file represents an account. There are 5 fields in each line: owner, number, balance, type (checking or savings), checkLimit or interest. The fields are separated by comma, ",". For example, th input file accounts.txt file may contain: James Bond, 200304, 1000. 33, checking, 20 Michelle Wang, 200224, 3333.3, savings, 0.5 Tayer Smith, 249843, 132.87, checking, 25 David Jess, 265334, 225.7, checking, 30 6. The program will read the lines and create checking or savings accounts accordingly. The accounts are stored in an ArrayList. 7. The program then writes the list of accounts in reserve order to the output file. 8. The program prints "Bye!" when it is done. 9. Given the previous input file accounts.txt, the output file, accounts reserved.txt, will be: David Jess, 265334, 225.7, checking, 30 Tayer Smith, 249843, 132.87, checking, 25 Michelle Wang, 200224, 3333.3, savings, 0.5 James Bond, 200304, 1000. 33, checking, 20 II. Implementation Requirements The program must implement a main class and three bank account classes (BankAccount, CheckingAccount, Savings Acount) which are specified in the following UML class diagram. The changes from previous assignments are shown in red. -owner: String -number: int BankAccount -balance: double +Bank Account() +Bank Account(String, int, double) +printBank Account():void +getNumber(): int +printBank Account(PrintWriter pw):void CheckingAccount -checkLimit: int +Checking Account() +Checking Account (String, int, double, int) +printBankAccount():void +printBankAccount(Print Writer pw):void Savings Account -interest: double + Savings Account () + Savings Account (String, int, double, double) +printBankAccount():void +printBank Account(Print Writer pw):void All classes must be in the same package. The package name must start with your last name. For example, if your last name is "Biden", your package name must start with "Biden" such as "BidenCIS265", "BidenData Structures", etc. • You main class file name must start with your last name. For example, if your last name is "Spiderman", your main class file name must start with "Spiderman" such as "Spiderman4.java", "SpidermanAssign4.java", etc. • The Bank Account class must be abstract and have a no-arg constructor, and a constructor with 3 parameters: a String, an int, and a double. It must have a method printBank Account() to print its owner, number, and balance. It must have a method getNumber() which returns its number. It also must have a method printBankAccount(Print Writer pw) that writes the account's owner, number, and balance to the file. • The Checking Account class must extends the BankAccount class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and an int. The constructor with parameters must call the Bank Account's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and checkLimit. It must also override the printBank Account(Print Writer pw) method to write its owner, number, balance, and checkLimit to the file. • The Savings Account class must extends the Bank Account class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and a double. The constructor with parameters must call the BankAccount's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and interest. It must also override the printBankAccount(Print Writer pw) method to write its owner, number, balance, and interest to the file. • Since I/O exceptions are checked exceptions, your main class must handle exceptions. You may use the try/catch or throw IOException. To throw exceptions, you declare it as: public static void main(String[] args) throws IOException • You may reuse the code from previous assignments. However, please not the changes to the bank account classes. • Your program must close both input and output files after they are done, unless they are put in the try-with- resource block. • You can assume that input file has the correct format. You will earn bonus points for handling incorrect input formats. III. Submission This is an individual assignment. Each student needs to submit the source code files of the Java program on Blackboard. In this assignment, you will create a Java program to read bank accounts, including checking and savings accounts, from an input file, and write them in reverse order to an output file. 1. The input file name and the output file name are passed in as the first and second arguments at command line, respectively. For example, assume your package name is FuCIS265 and your main class name is FuAssignment4, and your executable files are in "C:\Users\2734848\eclipse-workspace CIS 265 Assignments\bin". The following command line will read from a local file "accounts.txt" and write to a local file "accounts_reversed.txt": C:\Users\2734848\eclipse-workspace CIS 265 Assignments \bin > java FUCIS265. FuAssignment4 accounts.txt accounts_reversed.txt You need to specify the command line arguments if you use an IDE such as jGrasp or Eclipes. The parameter String[] args in the main method contains the command line arguments, where args[0] contains the first argument. For example, in the previous command, args[0] contains accounts.txt, and args [1] contains accounts_reversed.txt. 4. If the program is run with incorrect number of arguments, your program must print an error message and exit. The error message must show correct format to run your program, e.g., "Usage: FUCIS265.FuAssignment4 input file output_file" where FuCIS265 is the package and FuAssignment4 is the main class. 2. 3. 5. Each line in the input file represents an account. There are 5 fields in each line: owner, number, balance, type (checking or savings), checkLimit or interest. The fields are separated by comma, ",". For example, th input file accounts.txt file may contain: James Bond, 200304, 1000. 33, checking, 20 Michelle Wang, 200224, 3333.3, savings, 0.5 Tayer Smith, 249843, 132.87, checking, 25 David Jess, 265334, 225.7, checking, 30 6. The program will read the lines and create checking or savings accounts accordingly. The accounts are stored in an ArrayList. 7. The program then writes the list of accounts in reserve order to the output file. 8. The program prints "Bye!" when it is done. 9. Given the previous input file accounts.txt, the output file, accounts reserved.txt, will be: David Jess, 265334, 225.7, checking, 30 Tayer Smith, 249843, 132.87, checking, 25 Michelle Wang, 200224, 3333.3, savings, 0.5 James Bond, 200304, 1000. 33, checking, 20 II. Implementation Requirements The program must implement a main class and three bank account classes (BankAccount, CheckingAccount, Savings Acount) which are specified in the following UML class diagram. The changes from previous assignments are shown in red. -owner: String -number: int BankAccount -balance: double +Bank Account() +Bank Account(String, int, double) +printBank Account():void +getNumber(): int +printBank Account(PrintWriter pw):void CheckingAccount Savings Account -interest: double + Savings Account () + Savings Account (String, int, double, double) +printBankAccount():void -checkLimit: int +Checking Account() +Checking Account (String, int, double, int) +printBankAccount():void +printBankAccount(PrintWriter pw):void +printBank Account(Print Writer pw):void All classes must be in the same package. The package name must start with your last name. For example, if your last name is "Biden", your package name must start with "Biden" such as "BidenCIS265", "BidenData Structures", etc. • You main class file name must start with your last name. For example, if your last name is "Spiderman", your main class file name must start with "Spiderman" such as "Spiderman4.java", "SpidermanAssign4.java", etc. • The Bank Account class must be abstract and have a no-arg constructor, and a constructor with 3 parameters: a String, an int, and a double. It must have a method printBank Account() to print its owner, number, and balance. It must have a method getNumber() which returns its number. It also must have a method printBankAccount(Print Writer pw) that writes the account's owner, number, and balance to the file. • The Checking Account class must extends the BankAccount class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and an int. The constructor with parameters must call the Bank Account's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and checkLimit. It must also override the printBank Account(Print Writer pw) method to write its owner, number, balance, and checkLimit to the file. • The Savings Account class must extends the Bank Account class. It must have a no-arg constructor and a constructor with 4 parameters: a String, an int, a double, and a double. The constructor with parameters must call the BankAccount's constructor. It must also override the printBankAccount() method to print its owner, number, balance, and interest. It must also override the printBankAccount(Print Writer pw) method to write its owner, number, balance, and interest to the file. • Since I/O exceptions are checked exceptions, your main class must handle exceptions. You may use the try/catch or throw IOException. To throw exceptions, you declare it as: public static void main(String[] args) throws IOException • You may reuse the code from previous assignments. However, please not the changes to the bank account classes. • Your program must close both input and output files after they are done, unless they are put in the try-with- resource block. • You can assume that input file has the correct format. You will earn bonus points for handling incorrect input formats. III. Submission This is an individual assignment. Each student needs to submit the source code files of the Java program on Blackboard.
Expert Answer:
Answer rating: 100% (QA)
Solution A complete Java program that reads bank accounts from an input file stores them in an ArrayList and then writes them in reverse order to an output file import javaio import javautil BankAccou... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
How many acres would be required to build a 5 MW (electrical energy output) biomass power plant via wood chips combustion (operated 365 days a year and 24 hrs/day) if the heating value of the biomass...
-
Choose a topic that can be applied to one of the following economic concepts. (Possible curves: Lorenz curve, marginal product of labor curve, labor demand and supply curves, utility function and...
-
In this assignment, you will create a program that allows theuser to draw in a window using brushes of different sizes andcolors. The user will be able to change the size and color of thebrush using...
-
Develop a data type ResizingArrayQueueOfStrings that implements a queue with a fixed-length array in such a way that all operations take constant time. Then, extend your implementation to use a...
-
A small rigid object carries positive and negative 3.50-nC charges. It is oriented so that the positive charge has coordinates (-1.20 mm, 1.10 mm) and the negative charge is at the point (1.40 mm,...
-
The temporary tax difference is due to a $70,000 sale that could be recognized for GAAP purposes in 2021 but it had to be recognized for tax purposes on a prorata basis through 2023 Sheett a....
-
The process flowsheet and list of variables to specify for the HDA process are given in Figure 7.24 and Table 7.14. Perform simulations with any process simulator to match the results given in Tables...
-
A stock is trading at $80 per share. The stock is expected to have a year-end dividend of $4 per share (D1 = 4), which is expected to grow at some constant rate g throughout time. The stocks required...
-
How does catalytic dehydrogenation compare to hydrogenation in terms of mechanism, catalyst design, and application in industrial processes, such as the production of petrochemicals ?
-
LUKE'S GENERAL STORE Inventory December 31, 20X7 Price Test Results Proper Action (select one): Test Test Count Item Description Auditor Notes (last purchased Item# Results: price): Boxes appear...
-
Apply the knowledge of Management presented in this chapter to the following case. Applying this knowledge should enable you to have a better understanding of how Nokia uses social media to its...
-
We will now explore another way to derive an optimal investment equation. First, rewrite the capital accumulation identity as: K = (1-8)K+I 1 (3') Now assume that the firm is around for two periods....
-
The graphing of CVP data __________. provides the exact number of profit as sales levels change shows the sales revenue at varying levels does not show the point at which sales revenue covers all...
-
A recently married couple hopes to be first-time home buyers in 4 years. Based on their desired neighborhood they estimate they will need $22,000 for a down payment. How much money does the couple...
-
In a manufacturing firm, units to be produced are calculated as budgeted sales + desired Blank______. Multiple choice question. work-in-process ending inventory expected beginning work-in-process...
-
2 Consider the market for X. Suppose it is competitive. Two types of firms produce X. Type 1 has a MC function given by MC = (Q-10) + 100. Type 2 has a MC function given by MC2 = (Q2-8) + 100. Fifty...
-
Discuss why don't atoms collapse if they are mostly empty space?
-
What is the role of business risk analysis in the audit planning process?
-
When should a derived class define an assignment operator?
-
Write a function that takes three arguments: the name of an int array, the array size, and an int value. Have the function set each element of the array to the int value.
-
Write a function that has this prototype: int replace(char * str, char c1, char c2); Have the function replace every occurrence of c1 in the string str with c2, and have the function return the...
-
(T/F) EBTs should have a direct physical representation.
-
Where do you start developing BOs for any particular EBT? What questions do you need to ask?
-
What are the four characteristics that a BO must satisfy to fully qualify as a BO in any particular pattern?
Study smarter with the SolutionInn App