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...
-
What are some suggested methods to make saving easy?
-
The city of New London (hereinafter City) sits at the junction of the Thames River and the Long Island Sound in southeastern Connecticut. Decades of economic decline led a state agency in 1990 to...
-
Question: Lawrence Williams and his wife, Diana, enjoyed a luxurious lifestyle while his investment bank flourished. But when the bank failed, Lawrence was faced with debts of $6 million. On the eve...
-
The adjusted trial balance of Tsai Company shows the following data pertaining to sales at the end of its fiscal year October 31, 2014: Sales Revenue $820,000, Freight-Out $16,000, Sales Returns and...
-
Morgan Company acquires all of the outstanding shares of Jennings, Inc., for cash. Morgan transfers consideration more than the fair value of the company's net assets. In your opinion, how should the...
-
Fractional composition in a tetraprotic system. Prepare a fractional composition diagram analogous to Figure 9-4 for the tetraprotic system derived from hydrolysis of Cr3+: Cr3+ + (H2O) Cr(OH)2+ +...
-
Interpret the standard deviation of each variable and make a conclusion about the variability of the dataset. (Exclude ID and sex.)
-
Forest Company paid $38,000,000 for a warehouse and related assets from a company that was in bankruptcy. The warehouse includes land, building, moving equipment, and heating/ventilation/air...
-
What is the standard sales revenue? Opening Inventory 3.2 bottles Issues 7.5 bottles Ending Inventory 1.8 bottles Bottle size 1500 ml Drink size 1.9 ounces Drink price $5.90 Total drinks sold 230...
-
how fix this error import java.util.*; import java.lang.*; import java.io.*; import java.lang.Math; publicclass Main { publicstaticint leftrightString(String S) { //this is default OUT int result =0;...
-
The answer given previously related to the Minimum Variance Portfolio. Please note this question is about the Optimal Risky Portfolio: You are a fund manager in ABC asset management and you wish to...
-
A 30-year interest rate swap with a notional principal of $10,000,000 requires quarterly payments in arrears, based on 90-day LIBOR. The swap was entered into on April 1, 2015. If the fixed rate in...
-
Service Dimension: Data Sources for Service Dimension are Sales table, Special events worksheet, ServicePurchase table, ServiceCategory table in a fitness retail datawarehouse
-
You have accepted the engagement of auditing the financial statements of the C. Reis Company, a small manufacturing firm that has been your auditee for several years. Because you were busy writing...
-
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...
-
Paymore Shoes acquired 80 percent of the voting stock of Spire Footwear on February 1, 2014, for \($21\) million. The fair value of the noncontrolling interest at the acquisition date was \($3\)...
-
Pacific Athletic Corporation owns all of the voting stock of Solovair Apparel. Acquisition cost was \($10\) million in excess of Solovairs book value of \($2\) million, and the excess was attributed...
-
Peninsula Industries and Seaport Company, a 90 percent owned subsidiary, engage in extensive intercompany transactions involving raw materials, component parts, and completed products. Peninsula...
Study smarter with the SolutionInn App