Question: pp named Dace lest that demonstrates class Date's capabilities 4.13 (Removing Duplicated Code in Method Main) In the AccountTest class of Fig. 4.12, method Main



pp named Dace lest that demonstrates class Date's capabilities 4.13 (Removing Duplicated Code in Method Main) In the AccountTest class of Fig. 4.12, method Main contains six statements (lines 13-14, 15-16, 26-27, 29-29, 39-40 and 41-42) that each dis lay an Account object's Name and Balance. Study these statements and you'll notice that they dilfen only in the Account object being manipulated-accounti or account2. In this exercise, you'l detine a new DisplayAccount method that contains one copy of that output statement. The method's p rameter will be an Account object and the method will output the object's Name and Balance. You then replace the six duplicated statements in Main with calls to DisplayAccount, passing as an arg ment the specific Account object to output. u'll nt method Modify class AccountTest class of Fig, 4.12 to declare the following DisplayAccou after the closing right brace of Main and before the closi ng right brace of class AccountTest: static void DisplayAccount (Account accountToDisplay) // place the statement that displays // accountToDisplay's Name and Balance here Replace the comment in the member function's body with a statement that displays account play's Name and Balance. Note that Main is a static mrhad M
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
