Answered step by step
Verified Expert Solution
Question
1 Approved Answer
18.2 Lab Project - Classes (Bank Accounts) This is a Collaborative Project. You are expected to work on and complete this project during your
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() < > + accountinfo(): String < >> CreditcardAccount + debit(pennies: Int): boolean coverride>>> +applyinterest(coverride + accountinfo(): String override - limit: int + debit(pennies: int]: boolean coverride +getLimit(): Int + setlimit(creditLimit: int) + applyinterest() >> UML Class Diagram Bank Accounts Savings Ammunt CheckingAccount -overdraftFee: int + debit(pennies: int): boolean coverride + getFee(): Int + setFeeloverdraftFee : int) + applyinterest() < > + accountinfo(): String < > 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 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
Step by Step Solution
★★★★★
3.30 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
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 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started