Question: Write a main program to test the above functions and the Money structure. Question 1: [50 points] Define a structure named Money that stores US

Write a main program to test the above functions and the Money structure.
Question 1: [50 points] Define a structure named Money that stores US dollars and cents. The structure should have two integer data members one to store the number of dollars and another to store the number of cents. Implement and test the following functions: 1. int centsMonex const Money &m ): takes a reference parameter to Money, converts the dollars to cents and add them to the cents data member and returns the result as an integer 2. Money addMoney (const Money &ml, const Money & m2): takes two reference parameters, ml and m2, of type Money and returns a money structure that contains the sum of ml and m2. 3. Money subtractMoney (const Money &ml, const Money &m2) takes two reference parameters, ml and m2, of type Money and returns a money structure that contains ml - m2. If the ml-m2 results in negative values, then set the result money structure to zero and return it. 4. xid printMone (const Money &m): takes a reference parameter of type Money and print its data members out
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
