18.2 Lab Project - Classes (Bank Accounts) This is a Collaborative Project. You are expected to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
18.2 Lab Project - Classes (Bank Accounts) This is a Collaborative Project. You are expected to work on and complete this project during your weekly class meeting You are strongly encouraged to work and collaborate with one or two other students on this project. The Instructor and TAs will also be available to provide help and support when needed. Be sure to follow the instructions given by your instructor and Tas Copyright 2029 Arizona State University- This content is protected and may not be shared uploaded sold or distributed in whole or part. Copying any part of these instructions or any part of solution and sharing online or otherwise in any form is a violation of copyright laws and the ASU Academic integrity Policy All violations will be prosecuted Required Skills Inventory • Implement a method according to given structural and behavioral specifications . Write code that uses a pre-defined set of classes .Write polymorphic code Problem Description and Given Info For this project you must complete the implementation of a program that simulates the basic functions of a bank which offers accounts of various types (savings account, checking account, and credit card account) and supports common activities like deposits, withdrawals, transfers, etc. You must complete the Main class which provides the primary logic for this program. Note that the BankAccount, SavingsAccount, checkingAccount, and CreditcardAccount classes have already been fully implemented according to the specifications given by the UML Class Diagram below, and including all required logic (behavior). You will not be allowed to see any of the code for these classes, however, all the information you need to use them is provided in the UML Class Diagram, and in the text below. #accountID: String #interestRate: double #balance int BankAccount abstract + credit( amount: int): boolean + debit amount int): boolean ccabstract +getBalance: Int +getAccountID(): String + setAccountID accountID: String) + getinterestRate(): double + setinterestRate(interestRate: double) + applyinterest() <<abstract>> + accountinfo(): String <<abstract>>> CreditcardAccount + debit(pennies: Int): boolean coverride>>> +applyinterest(coverride + accountinfo(): String override - limit: int + debit(pennies: int]: boolean coverride +getLimit(): Int + setlimit(creditLimit: int) + applyinterest() <coverride + accountinfo(): String coverride>>> UML Class Diagram Bank Accounts Savings Ammunt CheckingAccount -overdraftFee: int + debit(pennies: int): boolean coverride + getFee(): Int + setFeeloverdraftFee : int) + applyinterest() <<override>> + accountinfo(): String <<override>> Notes regarding the above classes • All money amounts (credits, debits, and fees) are expressed in pennies (with no fractions). . An interest rate is expressed as a decimal (for example a 2 percent rate is expressed as 0.02). An interest rate is never negative. • A debit method will return false if the transaction cannot be made because of insufficient balance or insufficient credit limit. Otherwise it will return true. A successful debit operation will always subtract the argument amount from the account balance. • A credit method will always return true, because a credit operation will always succeed. A credit operation will always add the argument amount to the account balance. You must implement the following methods in the Main class. Each of these methods will be private and static. The set BasicAccount Data method must get a new account ID and an interest rate from the user (in that order), then set these values for the BankAccout object that is passed in as an argument. This method will be a void method with one parameter of type BankAccount. Remember that all BankAccount objects have setter methods for account ID and interest rate. Remember that methods to get an account ID, and an interest rate from the user already exist in the Main class. The addSavingsAccount method must instantiate a new SavingsAccount object, and then set the basic account data (account ID, and interest rate) for this account (these values will be collected from the user), and finally add this new account to the list of bank accounts (ArrayList<BankAccount> accounts). This method will be a void method with no parameters. Remember that you should have previously defined a method to set the basic data for an account in the Main class. The addCheckingAccount method must instantiate a new CheckingAccount, and then set the basic account data (account ID, and interest rate) for this account and then the overdraft fee (these values will be collected from the user), and finally add this new account to the list of bank accounts (accounts). This method will be a void method with no parameters. Remember that all CheckingAccount objects have a setter method for the overdraft fee. Remember that you should have previously defined a method to set the basic data for an account in the Main class. The addCreditcardAccount method must instantiate a new CreditcardAccount, and then set the basic account data (account ID, and interest rate), and then the credit limit for this account (these values will be collected from the user), and finally add this new account to the list of bank accounts (accounts). This method will be a void method with no parameters. Remember that all CreditcardAccount objects have a setter method for the credit limit. Remember that you should have previously defined a method to set the basic data for an account in the Main class. The addAccount method must display the account type menu, then collect the user's menu choice, and then call the appropriate method to handle the account type menu choice. This method will be a void method with no parameters. Remember that methods to display the account type menu, collect the user's menu choice, and to handle the account type menu choice already exist in the Main class. The makeCredit method must first get an account ID and an amount (in pennies) from the user (in that order). Then retrieve the account with that ID from the list of accounts, and then credit this account with the given amount. If no account with the given ID exists in the accounts then this method should print out the message*** Credit failed Invalid account number! ***. This method will be a void method with no parameters. Remember that all BankAccount objects have a credit method, and that methods to get an account ID and an amount from the user already exist in the Main class. The makeDebit method must first get an account ID and an amount (in pennies) from the user (in that order), Then retrieve the account with that ID from the list of accounts, and then attempt to debit this account by the given amount. If the debit method of the BankAccount returns false, then then this method should print out the message*** Debit failed Insufficient funds or credit! ***. If no account with the given ID exists in the accounts then this method should print out the message *** Debit failed Invalid account number! ***. This method will be a void method with no parameters. Remember that all BankAccount objects have a debit method, and that methods to get an account ID and an amount from the user already exist in the Main class The transferFunds method must first get the account ID's for the account to transfer from and the account to transfer to, and then the amount to transfer (in pennies) from the user (in that order). Then this method must retrieve the correct accounts from the list of accounts, and attempt a debit on the account to transfer from, and apply a credit to the account to transfer to. If no account with the either given ID exists in the accounts then this method should print out the message*** Transfer failed Invalid account number! ***. If the balance of the account to transfer from is less than the requested transfer amount, then this method should print out the message *** Transfer failed Insufficient funds! ***. This method will be a void method with no parameters. Remember that all BankAccount objects have a debit, credit, and getBalance methods, and that methods to get an account ID and an amount from the user already exist in the Main class. The viewAccount Details method must first get an account ID from the user, and then print out the account info for this account. If no account with the given ID exists in the accounts then this method should print out the message *** Operation failed Invalid account number! ***. This method will be a void method with no parameters. Remember that all BankAccount objects have an accountInfo method which returns a correctly formatted String with all the required account details. The applyMonthlyInterest method must apply interest to each account in the accounts list. Remember that all BankAccount objects have an applyInterest method. This method will take no arguments and return no value. Note: All methods that collect input from the user must collect all inputs (in the specified order) before executing any of the other logic (behavior) required of the method. Copyright 2023 Arizona State University-THIS CONTENT IS PROTECTED AND MAY NOT BE SHARED, UPLOADED, SOLD, OR DISTRIBUTED 18.2 Lab Project - Classes (Bank Accounts) This is a Collaborative Project. You are expected to work on and complete this project during your weekly class meeting You are strongly encouraged to work and collaborate with one or two other students on this project. The Instructor and TAs will also be available to provide help and support when needed. Be sure to follow the instructions given by your instructor and Tas Copyright 2029 Arizona State University- This content is protected and may not be shared uploaded sold or distributed in whole or part. Copying any part of these instructions or any part of solution and sharing online or otherwise in any form is a violation of copyright laws and the ASU Academic integrity Policy All violations will be prosecuted Required Skills Inventory • Implement a method according to given structural and behavioral specifications . Write code that uses a pre-defined set of classes .Write polymorphic code Problem Description and Given Info For this project you must complete the implementation of a program that simulates the basic functions of a bank which offers accounts of various types (savings account, checking account, and credit card account) and supports common activities like deposits, withdrawals, transfers, etc. You must complete the Main class which provides the primary logic for this program. Note that the BankAccount, SavingsAccount, checkingAccount, and CreditcardAccount classes have already been fully implemented according to the specifications given by the UML Class Diagram below, and including all required logic (behavior). You will not be allowed to see any of the code for these classes, however, all the information you need to use them is provided in the UML Class Diagram, and in the text below. #accountID: String #interestRate: double #balance int BankAccount abstract + credit( amount: int): boolean + debit amount int): boolean ccabstract +getBalance: Int +getAccountID(): String + setAccountID accountID: String) + getinterestRate(): double + setinterestRate(interestRate: double) + applyinterest() <<abstract>> + accountinfo(): String <<abstract>>> CreditcardAccount + debit(pennies: Int): boolean coverride>>> +applyinterest(coverride + accountinfo(): String override - limit: int + debit(pennies: int]: boolean coverride +getLimit(): Int + setlimit(creditLimit: int) + applyinterest() <coverride + accountinfo(): String coverride>>> UML Class Diagram Bank Accounts Savings Ammunt CheckingAccount -overdraftFee: int + debit(pennies: int): boolean coverride + getFee(): Int + setFeeloverdraftFee : int) + applyinterest() <<override>> + accountinfo(): String <<override>> Notes regarding the above classes • All money amounts (credits, debits, and fees) are expressed in pennies (with no fractions). . An interest rate is expressed as a decimal (for example a 2 percent rate is expressed as 0.02). An interest rate is never negative. • A debit method will return false if the transaction cannot be made because of insufficient balance or insufficient credit limit. Otherwise it will return true. A successful debit operation will always subtract the argument amount from the account balance. • A credit method will always return true, because a credit operation will always succeed. A credit operation will always add the argument amount to the account balance. You must implement the following methods in the Main class. Each of these methods will be private and static. The set BasicAccount Data method must get a new account ID and an interest rate from the user (in that order), then set these values for the BankAccout object that is passed in as an argument. This method will be a void method with one parameter of type BankAccount. Remember that all BankAccount objects have setter methods for account ID and interest rate. Remember that methods to get an account ID, and an interest rate from the user already exist in the Main class. The addSavingsAccount method must instantiate a new SavingsAccount object, and then set the basic account data (account ID, and interest rate) for this account (these values will be collected from the user), and finally add this new account to the list of bank accounts (ArrayList<BankAccount> accounts). This method will be a void method with no parameters. Remember that you should have previously defined a method to set the basic data for an account in the Main class. The addCheckingAccount method must instantiate a new CheckingAccount, and then set the basic account data (account ID, and interest rate) for this account and then the overdraft fee (these values will be collected from the user), and finally add this new account to the list of bank accounts (accounts). This method will be a void method with no parameters. Remember that all CheckingAccount objects have a setter method for the overdraft fee. Remember that you should have previously defined a method to set the basic data for an account in the Main class. The addCreditcardAccount method must instantiate a new CreditcardAccount, and then set the basic account data (account ID, and interest rate), and then the credit limit for this account (these values will be collected from the user), and finally add this new account to the list of bank accounts (accounts). This method will be a void method with no parameters. Remember that all CreditcardAccount objects have a setter method for the credit limit. Remember that you should have previously defined a method to set the basic data for an account in the Main class. The addAccount method must display the account type menu, then collect the user's menu choice, and then call the appropriate method to handle the account type menu choice. This method will be a void method with no parameters. Remember that methods to display the account type menu, collect the user's menu choice, and to handle the account type menu choice already exist in the Main class. The makeCredit method must first get an account ID and an amount (in pennies) from the user (in that order). Then retrieve the account with that ID from the list of accounts, and then credit this account with the given amount. If no account with the given ID exists in the accounts then this method should print out the message*** Credit failed Invalid account number! ***. This method will be a void method with no parameters. Remember that all BankAccount objects have a credit method, and that methods to get an account ID and an amount from the user already exist in the Main class. The makeDebit method must first get an account ID and an amount (in pennies) from the user (in that order), Then retrieve the account with that ID from the list of accounts, and then attempt to debit this account by the given amount. If the debit method of the BankAccount returns false, then then this method should print out the message*** Debit failed Insufficient funds or credit! ***. If no account with the given ID exists in the accounts then this method should print out the message *** Debit failed Invalid account number! ***. This method will be a void method with no parameters. Remember that all BankAccount objects have a debit method, and that methods to get an account ID and an amount from the user already exist in the Main class The transferFunds method must first get the account ID's for the account to transfer from and the account to transfer to, and then the amount to transfer (in pennies) from the user (in that order). Then this method must retrieve the correct accounts from the list of accounts, and attempt a debit on the account to transfer from, and apply a credit to the account to transfer to. If no account with the either given ID exists in the accounts then this method should print out the message*** Transfer failed Invalid account number! ***. If the balance of the account to transfer from is less than the requested transfer amount, then this method should print out the message *** Transfer failed Insufficient funds! ***. This method will be a void method with no parameters. Remember that all BankAccount objects have a debit, credit, and getBalance methods, and that methods to get an account ID and an amount from the user already exist in the Main class. The viewAccount Details method must first get an account ID from the user, and then print out the account info for this account. If no account with the given ID exists in the accounts then this method should print out the message *** Operation failed Invalid account number! ***. This method will be a void method with no parameters. Remember that all BankAccount objects have an accountInfo method which returns a correctly formatted String with all the required account details. The applyMonthlyInterest method must apply interest to each account in the accounts list. Remember that all BankAccount objects have an applyInterest method. This method will take no arguments and return no value. Note: All methods that collect input from the user must collect all inputs (in the specified order) before executing any of the other logic (behavior) required of the method. Copyright 2023 Arizona State University-THIS CONTENT IS PROTECTED AND MAY NOT BE SHARED, UPLOADED, SOLD, OR DISTRIBUTED
Expert Answer:
Answer rating: 100% (QA)
Here are the steps and explanations for each modification you need in your MyString class 1 Build a basic opportunity Problem The specified capacity is incorrect If greater than 16 it should be set to ... View the full answer
Related Book For
Project Management The Managerial Process
ISBN: 9781260570434
8th Edition
Authors: Eric W Larson, Clifford F. Gray
Posted Date:
Students also viewed these programming questions
-
Recently, you needed money and agreed to sell a car you had inherited at a price of $45,000 , to be paid in monthly payments of $1,300 for 45 months . What (annual) interest rate did you charge for...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Find each product. -3a+(4 + a)
-
A researcher reports the following regression equation for the relationship between two variables: = 1.3X + 2. Find the predicted value of Y, given that X = 0, 2, 4, and 8.
-
As noted previously, P/E is a price multiple frequently used by analysts. Using P/E in the method of comparables can be problematic, however, as a result of business cycle effects on EPS. An...
-
Bloy Company pays all salaried employees on a biweekly basis. Overtime pay, however, is paid in the following biweekly period. Bloy accrues salaries expense only at its December 31 year-end. Data...
-
For the following independent situations, assume that you are the audit partner on the engagement: 1. In the last 3 months of the current year, Oil Refining Company decided to change direction and go...
-
You are a manager at Northern Fibre, which is considering expanding its operations in synthetic fibre manufacturing. Your boss comes into your office, drops a consultant's report on your desk, and...
-
1.How much gain on derecognition of the corporate housing facility should Snack That, as seller-lessee, recognize as a result of the sale? 2.How much gain on derecognition of the shuttle should Snack...
-
Be familiar with 10 core competencies for working in developmental support services. The core competencies are Advocacy, building relationships, championing change and innovation, facilitating growth...
-
Julies' Merchandise has budgeted sales as follows for the third quarter of the year: July $ 4 4 , 0 0 0 August $ 7 5 , 0 0 0 September $ 6 4 , 0 0 0 Cost of goods sold in the company is equal to 7 0...
-
The fixed cost of B ltd. is $20,000, variable costs are $16,000 and break-even point is $8,000. You are required to find the sales and net profit of B ltd.
-
Project manager told his boss in a meeting that "Cost estimates and budgets are ideally based upon elements of the WBS and are prepared at the work package level. But when the cost cannot be...
-
The subject of your individual assignment is "Seven Quality Control Tools." These tools are listed here. 1. Data figures, 2. Pareto analysis, 3. Cause and effect analysis, 4. Trend analysis, 5....
-
A 30-year-old worker plans to retire at age 65. He believes that $800,000 is needed to retire comfortably. How much should be deposited now at 8% compounded monthly to meet the $800,000 < retirement...
-
HEC Company's balance sheet on December 31, 2022, is presented below: HEC Company Assets Liability and Equity Cash $ 11,875.00 Accounts receivable $ 19,780.00 Less: Allowance for foubtful accounts $...
-
Why are stocks usually more risky than bonds?
-
Brandon was having an ale with his girlfriend, Sierra, when the subject of the Omega Theta Pi 5K-run project came up. Brandon has been chosen to chair the 5K-charity run for his fraternity. At the...
-
How important is leading by example on a project?
-
How did limiting work packages to one week help management identify problems sooner?
-
Prepare a consolidated balance sheet from the following details as at 31 March 2006. During the year, Pa sold goods which had cost 1,900 to Daughter for 2,800. None of these goods had been sold by...
-
The following information relates to Heather Limited and its subsidiary, Thistle*Limited. 1. Heather Limited Retained profits as at 31 March 2008 700,000. 80,000 ordinary shares were purchased in...
-
Draw up a consolidated balance sheet as at 31 December 2007 from the following: At the balance sheet date, Child owes Parent 3,200. During the year Parent sold goods which had cost 6,000 to Child for...
Study smarter with the SolutionInn App