Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this question, you will implement an account system with four main classes and test their features in a test class. For this purpose,
In this question, you will implement an account system with four main classes and test their features in a test class. For this purpose, carefully follow these steps: 1. Check the given UML diagram carefully and implement the corresponding classes 2. Even not written, add at least one meaningful constructor, one tostring() method (which prints relative account holder information) and one equals() method to each class. In the parent constructor, do not forget to increment the number of holders each time a new account holder is created. 3. All setters and getters can be implemented similar to what we have done in our lectures. 4. maxAccount () method checks the list of accounts that the holder has and returns the account with the maximum balance. 5. computeCurrentCredit method returns the available credit amount by using this algorithm: a. for Corporate: if (Today's Year - entering Year) >10) return max (maxAccount().getBalance(/3, creditLimit); return creditLimit; else b. for Individual: IndividualHolder if (maxAccount().getBalance() > creditLimit) return creditLimit*1,5; else 6. Now, create a test/driver class, namely TestAccountHolders, and create 4 Corporate and 4 Individual holders here. Keep your account holders in an ArrayList. Since you are free to implement your own style constructors, I will not show any sample output. 7. For each holder, be sure that it has at least 2 accounts. 8. By traversing over your arraylist (NOT ONE BY ONE), compute the current credit of each holder and print corresponding information by calling that class' to String() method. return creditLimit; < > AccountHolder #name: String #accountHolderId: String #creditLimit:int #entering Year:int #listOfAccounts:Account[] +totalNrOfHolders +getName():String +setName(name:String) +getId():String +setId(accountHolderId:String) +getCreditLimit():int +setCreditLimit(limit:int) -SSN:String +getSSN():String +setSSN(SSN:String) +computeCurrentCredit():int +getEntering Year():int +setEntering Year(limit:int) +maxAccount():Account +computeCurrentCredit():int KH Account -id:String -openingYear:int -balance:int +getId():String +setId(id:String) +getYear():int +set Year(opening Year:int) +getBalance ():int +setBalance (balance:int) Corporate Holder -taxid:String -getTaxId():String +setTaxId(id:String) +computeCurrentCredit():int
Step by Step Solution
★★★★★
3.45 Rating (158 Votes )
There are 3 Steps involved in it
Step: 1
solve the problem Implement the classes Start by implementing the AccountHolder class This class should have the following attributes name A string 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