The Requirements:This program will include a tester for a class namedMoneyInCents. The class may be based on code from Case Study Part 1 (attached)Class Member Variable:int...

1 answer below »












The Requirements:


























This program will include a tester for a class namedMoneyInCents. The class may be based on code from Case Study Part 1 (attached)













Class Member Variable:












int amount




















    • This variable contains the money in all cents












Class Member Functions:












MoneyInCents(int allCents = 0) {amount = allCents;}




















    • This serves default constructor when called with no arguments



    • When called with an integer argument, it will assignamountto that value.


















void readMoney ();

















    • This function will be an adaptation of the readMoney done for Case Study Part 1.



    • Instead of returning a value, it will setamountto what was the integer result.









    • To call: moneyInstance.readMoney();























string convertMoney ();

















    • This function will be an adaptation of the convertMoney done for Case Study Part 1.



    • It will still return a string value for use in output statements after converting the value ofamount.



    • To call:


      moneyInstance.convertMoney();























void add(MoneyInCents left, MoneyInCents right);

















    • This function will allow an instance's amount of MoneyInCents to be assigned the sum ofamountof two other instances



    • To make the receiving amount visible,this->amountis used. If the parameter variable were left and right, the assignment statement for the sum would be written as:





      this->amount = left.amount + right.amount;








    • money3.add(money1, money2);




















void subtract(MoneyInCents left, MoneyInCents right);

















    • This function will allow an instance's amount of MoneyInCents to be the difference ofamountof two other instances



    • Like the add function above,



      this->amount = left.amount - right.amountwill be computed to get the difference.















Driver Program:








  • Write a program that will test the class.



  • Create instances of classes.



  • Assign a value toamountin an instance using the read-only function



  • Addamountvalues of two instances and assign it toamountin a third



  • Add and subtract the amount values of two instances and assign it to amount in a third



  • Using the convertMoney function output each of the three instances.



  • Extra credit: After you are done testing, modify the program so that the output (not the prompting and input) writes to a file instead of the console. Make sure that the appearance of the output is professional.



















The submission to Blackboard will include two (three or four files if you are doing file i/o) all uploaded to Blackboard separately (


NOT IN A ZIP FILE


) so that I can give you feedback directly in Blackboard:





















  • CS2_YourLastName.cpp





    • Introductory comments should include



      • Your name



      • The title (Case Study Part 2)



      • The date



      • The purpose of the contents









    • Clean indenting



    • White space as needed



    • Separation comments to indicate the functions



    • Commenting when necessary to explain structure or algorithm selection





































  • CS2_Console.docx











    • Test data and expected results








    • The console window: snip and paste to a Word document























  • (optional) CS2_Output_YourLastName.txt








    • The output from the testing














Note: Do not include any Visual Studio files










Answered Same DayNov 27, 2022

Answer To: The Requirements:This program will include a tester for a class namedMoneyInCents. The class...

Vikas answered on Nov 27 2022
40 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here