For this lab, we are evolving our Banking System of Lab4 so we can make it...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
For this lab, we are evolving our Banking System of Lab4 so we can make it more robust and a bit richer in its services. The purpose is to apply further the concepts of inheritance, composition, polymorphism, the implementation of interfaces methods and mostly, the usage of Exceptions handling in terms of throwing, catching and defining them. You can freely use any of the classes of Lab4 but you would need to apply the modification to them as per the new requirements described here. Some features are replaced with others while some remain the same. The other goal of this lab is to create POJO classes (Plain Old Java Object) that can be transformed into beans for serialization and persistence. As the first step, you need to create the following classes: Person class: should have personal attributes and required constructor. As you can see, this class now would have only one constructor that takes all Person attributes. No more "no argument" constructor. This requires the readPerson method to be moved either into the driver class or another class. This is to depict real life experience where a Person cannot exist at any time without its attributes i.e., an empty Person object; hence the forbiddance of default/no argument constructor. Account class: abstract class. Should have instance variables to represent the account holder (Person object), the balance, account number and a credit card reference. There should be one constructor that takes a Person object. Therecould be methods to read relevant information and to display the details. With this new version, you need to account for methods as deposit, withdraw, return an account number and a credit card, as well as adding a credit card to an account object. You need to override as well the toString() method so you can display the complete details of an account, including the details of the Person account holder. It is the method that displays the content of a row for each account listed. Chequing class: This is a specific type of account that has a specific fee of $1.5 for every transaction, except if the balance, at the time of the transaction, is greater than $3000; i.e., the fee is not applied if the balance is more than $3000. This fee is stored as a constant. Now the account number is automatically provided when an account is created; i.e., you need to keep track of the account number and increment it for every account created. Also, no two accounts (Chequing or Savings) would have the same account number. This number should be unique. This class takes care of the withdrawal and deposit process, along with the respective usage of the exception classes. Verify the rules pertaining to these types of transactions below. Savings class: This is a specific type of account that has an auto incremented account number for every Savings account created, just like the Chequing one. It holds a fee of $0.5 for every transaction regardless of the balance amount. We will be skipping the monthly update and the interest rate as per Lab4. This class takes care of the withdrawal and deposit process, along with the respective usage of the exception classes. Verify the rules pertaining to these types of transactions below. Bank class: This class should have a name (String) which is the name of the bank, and an ArrayList named accounts, which is an ArrayList of Account objects as instance variables. One constructor is required and it is the one that takes the name of the bank. A bank object should not exist without its name. This constructor sets the name of the Bank and creates the ArrayList of accounts. The main point of the new design is to build on your experience with Lab4 while keeping the MVC design pattern in mind. MVC stands for Model View Controller and the idea behind the abstract classes, the interfaces and their implementation are to hold the "model" where the data resides. The driver class would take care of the menu display and everything that has to do with the Scanner instance; hence, the "view" of the MVC. The "controller" is defined with the methods that interact with the Model and the View. These methods can exist inside Bank or the driver but we need to keep using only one Scanner object, as in Lab4 but to limit it to the driver class, BankTest. In real life, the model is persisted inside a database or some storage, which can be implemented using the file system as well. CreditCard interface: This is a simple interface that has one method, the one that returns the number (16 digits) of a credit card as a String with the card type listed at the end of it; i.e., 5522123456781001 (MC) or 4422123456781002 (V) for example, where MC stands for MasterCard and V for Visa. MasterCard class: This class is an implementation of the CreditCard interface along with carrying out of the credit card unique number. All MasterCard objects, for the purpose of this assignment, need to have this pattern of 5522123456781XXX where XXX are the ones that increment. Our limitation here is that we can only have 999 MasterCards. I guess this is enough for us → Visa class: This class is an implementation of the CreditCard interface along with carrying out of the credit card unique number. All Visa objects, for the purpose of this assignment, need to have this pattern of 4422123456781XXX where XXX are the ones that increment. Our limitation here is that we can only have 999 Visa cards. I guess this is enough as well for us. Exceptions All custom exception classes should have Exception as their parent. They all need to only have their respective constructor that takes a String message. The list of these exception classes is: AccountNotFoundException InsufficientFundException Transation Amount Cannot BeNegative Bank Test class This is the driver class (test class), which means this class has the main method. Main method ⚫ This method read the name of the bank (example: "Spectrum") A Bank object will be created with the name provided • Displays all the menus and submenus listed in the sample output below • Handles most of Controller part of the MVC design pattern but shares some as well with Bank class Rules: While printing the title, see that it is printed in uppercase even if the user entered it in lowercase or camelCase ⚫ The methods that you need to override in subclasses should have the same signatures as defined in their parent classes, including any exception thrown • As listed below, for every menu/submenu option, the user can enter a non-equivalent value and the program should be to handle it with no exception thrown (InputMismatchException or anything similar); i.e., if the menu options are 1. Or 2., the user can enter any other number and the program needs to recover gracefully by keep prompting and repeating the same menu/submenu until a valid selection is given • Also, when a menu or submenu is presented, the user can enter a letter or a word (NOT more than one word) and although the program expects an int or a double for example, with the usage of exceptions, your program needs to handle the situation properly and keeps prompting with the same menu/submenu options until a valid selection is entered Again, no two accounts can have the same numbers • Every account can only hold one credit card. If you re-add a credit card to an account, the new credit card number will override the old one • When displaying the details of an account, the last column, which is for the credit card, needs to only appear if there is a credit card number on the account. If no credit card has been added to the account, that last column needs not to appear. Make use of the ternary operator in this case, inside the toString() implementation • Please remember to submit code with no typos in it while copying and pasting between different versions • Also remember that explaining your code takes precedence over sane code; i.e., if you cannot explain some part of your code, that will affect your marks, despite the fact that your code runs successfully Grading Scheme... in relation to explaining your code during code demo Item Person class Marks Required 1 Account class Chequing class Savings class Bank class CreditCard interface MasterCard class 1 1 1 1 Visa class AccountNotFoundException Insufficient FundException TransactionAmount Cannot BeNegative BankTest class (main method) Comments & Javadoc comments UML Test Plan 1 1 1 1 2 2 2 4 Submission Zip your code, JavaDoc, UML diagram, and test plan in a folder named <LastName><FirstName>Lab5.zip and submit it to Brightspace before the due date. Demonstrate your work to your lab professor during your own lab hours. Be ready with the exported Javadoctoo. Both submission and demo are required to get grades. Expected Output (blue - user input) Enter the name of the bank: bmo 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 You need to create an account first 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 3 You need to create an account first 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 4 You need to create an account first 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit abc Invalid menu option. Try again... 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 1 Let's get to know our new customer. Enter first name: Michel Enter last name: Choueiry Enter email: mic@mic.com Enter phone number: 6135551212 1. Chequing 2. Savings 3 Invalid menu option. Try again... 1. Chequing 2. Savings abc Invalid menu option. Try again... 1. Chequing 2. Savings 1 Acc number Name Email Phone Number | Balance | ********** 1 | Michel Choueiry | mic@mic.com | 6135551212| 1. Create Account 2. Transactions 0.0| 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 *** Acc number | Name | Email | Phone Number | Balance *** 1 | Michel Choueiry mic@mic.com 6135551212| 0.0 Enter account number: 9 Account number entered 9 is not found. Try again... Enter account number: abc Invalid menu option. Try again... Enter account number: 1 1. Deposit 2. Withdraw 3. Balance 9 Invalid menu option. Try again... 1. Deposit 2. Withdraw 3. Balance abc Invalid menu option. Try again... 1. Deposit 2. Withdraw 3. Balance 1 Enter the amount to deposit: abc Invalid deposit amount... Enter the amount to deposit: -9 ***** *** Transaction amount cannot be negative Enter the amount to deposit: 90 Acc number Name Email | Phone Number | Balance | ******* 1 | Michel Choueiry | mic@mic.com | 6135551212| 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 88.5 | Acc number Name Email | Phone Number | Balance | **** 1 | Michel Choueiry | mic@mic.com] 6135551212| Enter account number: 1 1. Deposit 2. Withdraw 3. Balance 2 Enter the amount to withdraw: abc Enter a valid withdrawal amount... Enter the amount to withdraw: -9 Transaction amount cannot be negative Enter the amount to withdraw: 40 88.5 | Acc number Name Email Phone Number | Balance | **** 1 | Michel Choueiry| mic@mic.com | 6135551212| 47.0| 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 Acc number Name | Email | Phone Number | Balance | 1 | Michel Choueiry mic@mic.com] 6135551212 Enter account number: 1 1. Deposit 2. Withdraw 3. Balance 3 Account balance: 47.0 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 1 Let's get to know our new customer. Enter first name: Shelly Enter last name: Doe Enter email: sdoe@me.com Enter phone number: 6136783456 1. Chequing 47.0 2. Savings 2 Acc number Name Email | Phone Number | Balance | *** 2 Shelly Doe sdoe@me.com | 6136783456| 0.0| **** 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 Acc number Name | Email | Phone Number | Balance | *** 1 | Michel Choueiry mic@mic.com | 6135551212 | 47.0 | 2 Shelly Doesdoe@me.com | 6136783456| 0.0 | Enter account number: 2 1. Deposit 2. Withdraw 3. Balance 1 Enter the amount to deposit: 100 Acc number Name | Email | Phone Number | Balance | 2 Shelly Doe sdoe@me.com| 6136783456| 1. Create Account 2. Transactions 3. Print all Accounts 99.5 | 4. Apply for Credit Card 5. Exit 3 BMO BANK Acc number Name Email Phone Number | Balance | **** 1 | Michel Choueiry | mic@mic.com | 6135551212| 2 Shelly Doe | sdoe@me.com | 6136783456| 47.0 | 99.5 | For this lab, we are evolving our Banking System of Lab4 so we can make it more robust and a bit richer in its services. The purpose is to apply further the concepts of inheritance, composition, polymorphism, the implementation of interfaces methods and mostly, the usage of Exceptions handling in terms of throwing, catching and defining them. You can freely use any of the classes of Lab4 but you would need to apply the modification to them as per the new requirements described here. Some features are replaced with others while some remain the same. The other goal of this lab is to create POJO classes (Plain Old Java Object) that can be transformed into beans for serialization and persistence. As the first step, you need to create the following classes: Person class: should have personal attributes and required constructor. As you can see, this class now would have only one constructor that takes all Person attributes. No more "no argument" constructor. This requires the readPerson method to be moved either into the driver class or another class. This is to depict real life experience where a Person cannot exist at any time without its attributes i.e., an empty Person object; hence the forbiddance of default/no argument constructor. Account class: abstract class. Should have instance variables to represent the account holder (Person object), the balance, account number and a credit card reference. There should be one constructor that takes a Person object. Therecould be methods to read relevant information and to display the details. With this new version, you need to account for methods as deposit, withdraw, return an account number and a credit card, as well as adding a credit card to an account object. You need to override as well the toString() method so you can display the complete details of an account, including the details of the Person account holder. It is the method that displays the content of a row for each account listed. Chequing class: This is a specific type of account that has a specific fee of $1.5 for every transaction, except if the balance, at the time of the transaction, is greater than $3000; i.e., the fee is not applied if the balance is more than $3000. This fee is stored as a constant. Now the account number is automatically provided when an account is created; i.e., you need to keep track of the account number and increment it for every account created. Also, no two accounts (Chequing or Savings) would have the same account number. This number should be unique. This class takes care of the withdrawal and deposit process, along with the respective usage of the exception classes. Verify the rules pertaining to these types of transactions below. Savings class: This is a specific type of account that has an auto incremented account number for every Savings account created, just like the Chequing one. It holds a fee of $0.5 for every transaction regardless of the balance amount. We will be skipping the monthly update and the interest rate as per Lab4. This class takes care of the withdrawal and deposit process, along with the respective usage of the exception classes. Verify the rules pertaining to these types of transactions below. Bank class: This class should have a name (String) which is the name of the bank, and an ArrayList named accounts, which is an ArrayList of Account objects as instance variables. One constructor is required and it is the one that takes the name of the bank. A bank object should not exist without its name. This constructor sets the name of the Bank and creates the ArrayList of accounts. The main point of the new design is to build on your experience with Lab4 while keeping the MVC design pattern in mind. MVC stands for Model View Controller and the idea behind the abstract classes, the interfaces and their implementation are to hold the "model" where the data resides. The driver class would take care of the menu display and everything that has to do with the Scanner instance; hence, the "view" of the MVC. The "controller" is defined with the methods that interact with the Model and the View. These methods can exist inside Bank or the driver but we need to keep using only one Scanner object, as in Lab4 but to limit it to the driver class, BankTest. In real life, the model is persisted inside a database or some storage, which can be implemented using the file system as well. CreditCard interface: This is a simple interface that has one method, the one that returns the number (16 digits) of a credit card as a String with the card type listed at the end of it; i.e., 5522123456781001 (MC) or 4422123456781002 (V) for example, where MC stands for MasterCard and V for Visa. MasterCard class: This class is an implementation of the CreditCard interface along with carrying out of the credit card unique number. All MasterCard objects, for the purpose of this assignment, need to have this pattern of 5522123456781XXX where XXX are the ones that increment. Our limitation here is that we can only have 999 MasterCards. I guess this is enough for us → Visa class: This class is an implementation of the CreditCard interface along with carrying out of the credit card unique number. All Visa objects, for the purpose of this assignment, need to have this pattern of 4422123456781XXX where XXX are the ones that increment. Our limitation here is that we can only have 999 Visa cards. I guess this is enough as well for us. Exceptions All custom exception classes should have Exception as their parent. They all need to only have their respective constructor that takes a String message. The list of these exception classes is: AccountNotFoundException InsufficientFundException Transation Amount Cannot BeNegative Bank Test class This is the driver class (test class), which means this class has the main method. Main method ⚫ This method read the name of the bank (example: "Spectrum") A Bank object will be created with the name provided • Displays all the menus and submenus listed in the sample output below • Handles most of Controller part of the MVC design pattern but shares some as well with Bank class Rules: While printing the title, see that it is printed in uppercase even if the user entered it in lowercase or camelCase ⚫ The methods that you need to override in subclasses should have the same signatures as defined in their parent classes, including any exception thrown • As listed below, for every menu/submenu option, the user can enter a non-equivalent value and the program should be to handle it with no exception thrown (InputMismatchException or anything similar); i.e., if the menu options are 1. Or 2., the user can enter any other number and the program needs to recover gracefully by keep prompting and repeating the same menu/submenu until a valid selection is given • Also, when a menu or submenu is presented, the user can enter a letter or a word (NOT more than one word) and although the program expects an int or a double for example, with the usage of exceptions, your program needs to handle the situation properly and keeps prompting with the same menu/submenu options until a valid selection is entered Again, no two accounts can have the same numbers • Every account can only hold one credit card. If you re-add a credit card to an account, the new credit card number will override the old one • When displaying the details of an account, the last column, which is for the credit card, needs to only appear if there is a credit card number on the account. If no credit card has been added to the account, that last column needs not to appear. Make use of the ternary operator in this case, inside the toString() implementation • Please remember to submit code with no typos in it while copying and pasting between different versions • Also remember that explaining your code takes precedence over sane code; i.e., if you cannot explain some part of your code, that will affect your marks, despite the fact that your code runs successfully Grading Scheme... in relation to explaining your code during code demo Item Person class Marks Required 1 Account class Chequing class Savings class Bank class CreditCard interface MasterCard class 1 1 1 1 Visa class AccountNotFoundException Insufficient FundException TransactionAmount Cannot BeNegative BankTest class (main method) Comments & Javadoc comments UML Test Plan 1 1 1 1 2 2 2 4 Submission Zip your code, JavaDoc, UML diagram, and test plan in a folder named <LastName><FirstName>Lab5.zip and submit it to Brightspace before the due date. Demonstrate your work to your lab professor during your own lab hours. Be ready with the exported Javadoctoo. Both submission and demo are required to get grades. Expected Output (blue - user input) Enter the name of the bank: bmo 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 You need to create an account first 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 3 You need to create an account first 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 4 You need to create an account first 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit abc Invalid menu option. Try again... 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 1 Let's get to know our new customer. Enter first name: Michel Enter last name: Choueiry Enter email: mic@mic.com Enter phone number: 6135551212 1. Chequing 2. Savings 3 Invalid menu option. Try again... 1. Chequing 2. Savings abc Invalid menu option. Try again... 1. Chequing 2. Savings 1 Acc number Name Email Phone Number | Balance | ********** 1 | Michel Choueiry | mic@mic.com | 6135551212| 1. Create Account 2. Transactions 0.0| 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 *** Acc number | Name | Email | Phone Number | Balance *** 1 | Michel Choueiry mic@mic.com 6135551212| 0.0 Enter account number: 9 Account number entered 9 is not found. Try again... Enter account number: abc Invalid menu option. Try again... Enter account number: 1 1. Deposit 2. Withdraw 3. Balance 9 Invalid menu option. Try again... 1. Deposit 2. Withdraw 3. Balance abc Invalid menu option. Try again... 1. Deposit 2. Withdraw 3. Balance 1 Enter the amount to deposit: abc Invalid deposit amount... Enter the amount to deposit: -9 ***** *** Transaction amount cannot be negative Enter the amount to deposit: 90 Acc number Name Email | Phone Number | Balance | ******* 1 | Michel Choueiry | mic@mic.com | 6135551212| 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 88.5 | Acc number Name Email | Phone Number | Balance | **** 1 | Michel Choueiry | mic@mic.com] 6135551212| Enter account number: 1 1. Deposit 2. Withdraw 3. Balance 2 Enter the amount to withdraw: abc Enter a valid withdrawal amount... Enter the amount to withdraw: -9 Transaction amount cannot be negative Enter the amount to withdraw: 40 88.5 | Acc number Name Email Phone Number | Balance | **** 1 | Michel Choueiry| mic@mic.com | 6135551212| 47.0| 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 Acc number Name | Email | Phone Number | Balance | 1 | Michel Choueiry mic@mic.com] 6135551212 Enter account number: 1 1. Deposit 2. Withdraw 3. Balance 3 Account balance: 47.0 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 1 Let's get to know our new customer. Enter first name: Shelly Enter last name: Doe Enter email: sdoe@me.com Enter phone number: 6136783456 1. Chequing 47.0 2. Savings 2 Acc number Name Email | Phone Number | Balance | *** 2 Shelly Doe sdoe@me.com | 6136783456| 0.0| **** 1. Create Account 2. Transactions 3. Print all Accounts 4. Apply for Credit Card 5. Exit 2 Acc number Name | Email | Phone Number | Balance | *** 1 | Michel Choueiry mic@mic.com | 6135551212 | 47.0 | 2 Shelly Doesdoe@me.com | 6136783456| 0.0 | Enter account number: 2 1. Deposit 2. Withdraw 3. Balance 1 Enter the amount to deposit: 100 Acc number Name | Email | Phone Number | Balance | 2 Shelly Doe sdoe@me.com| 6136783456| 1. Create Account 2. Transactions 3. Print all Accounts 99.5 | 4. Apply for Credit Card 5. Exit 3 BMO BANK Acc number Name Email Phone Number | Balance | **** 1 | Michel Choueiry | mic@mic.com | 6135551212| 2 Shelly Doe | sdoe@me.com | 6136783456| 47.0 | 99.5 |
Expert Answer:
Answer rating: 100% (QA)
Based on the requirements provided here are the Java classes you need to implement import javautilArrayList Person class public class Person private String name private String address private String p... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Suppose that the weight of a typical American male follows a normal distribution with = 180 lb and = 30 lb. Also, suppose 91.92% of all American males weigh more than I weigh. a. What fraction of...
-
A1050-kg car rounds a curve of radius 72 m banked at an angle of 14. If the car is traveling at 85km / h, will a friction force be required? If so, how much and in what direction?
-
Spreads in the news Find an article in a newspaper, a magazine, or the Internet that discusses a measure of spread. 1. Does the article discuss the Ws for the data? 2. What are the units of the...
-
In the organizational chart for the consumer-packaged goods firm in Figure 22 5, where do product line, functional, and geographical groupings occur? Figure 22-5 Chief Marketing Officer or Vice...
-
General Capital Assets. Make all necessary entries in the appropriate governmental hind general journal and the government-wide governmental activities general journal for each of the following...
-
what are three techniques for processing BI DATA? explain clearly REPORTING ANALYSIS, RFM ANALYSIS,ONLINE ANALYTICAL PROCESSING,DATA MINING ANALYSIS?
-
Explain how each of the traditional advertising executional frameworks noted. Or not related to the international advertising executional frameworks.
-
On January 1, 2021, the company obtained a $3 million loan with a 12% interest rate. The building was completed on September 30, 2022. Expenditures on the project were as follows: January 1, 2021 $...
-
Prepare a memorandum to the audit manager, outlining your risk assessment relating to Western Timber Limited (WTL). When making your risk assessment: (a) Identify three (3) key account balances from...
-
If a company's cash flow from financing is negative, it means that the company has had a loss this year.
-
If you would develop a website with multiple (5-7) pages using HTML and CSS coding that has the following: Images Links (absolute links, relative links, fragment identifier links, image links, email...
-
true or false? The conservative approach to financing a business uses long-term funding sources to finance capital assets, permanent current assets and part of temporary current assets.
-
Level 2 of the Sequential Investing Hierarchy is: Group of answer choices Eliminate all high interest and short-term debt Save for major purchases Diversify to meet long-term goals Create an...
-
You plan to make annual deposits of $5,000 per year at the beginning of each year into your retirement account. Your goal is to have $800,000 If you expect to get an 8% rate of return, how many years...
-
From a medical tourist perspective, compare Shouldice with the traditional hospital in terms of the key factors of competition. Using Table 15-3, why would Shouldice attract patients from outside the...
-
On February 2, 2012, Alexandra purchases a personal computer for her home. The computer cost $3,000. Alexandra uses the computer 80 percent of the time in her accounting business, 10 percent of the...
-
Cedar Corporation has an S corporation election in effect. During the 2012 calendar tax year, the corporation had ordinary taxable income of $200,000, and on January 15, 2012, the corporation paid...
-
Frederick (Freddy) Freeweights (age 42) owns and operates a health club called ''Treadmills West.'' The business is located at 4321 Arnold Street, Alpine, CA 91901. Freddy had the following income...
-
In an efficient market, the change in a companys share price is most likely the result of: A. Insiders private information. B. The previous days change in stock price. C. New information coming into...
-
Regulation that restricts some investors from participating in a market will most likely: A. Impede market efficiency. B. Not affect market efficiency. C. Contribute to market efficiency.
-
Which of the following regulations will most likely contribute to market efficiency? Regulatory restrictions on: A. Short selling. B. Foreign traders. C. Insiders trading with nonpublic information.
Study smarter with the SolutionInn App