Question: Write a code in C++ ! The output should be the same and Total of two money also. class Money { public: Money(); Money(int dollars,
The output should be the same and Total of two money also. class Money \{ public: Money(); Money(int dollars, int cents); void setDollars(int); void setCents(int); int getDollars (); int getCents(); friend Money add(Money amount1, Money amount 2); friend bool equal(Money amount1, Money amount 2); double get_value(); // if 12 dollars and 40 cents, this return $12.40 private: int dollars; 3; cents; Enter the amount of your money: 10023 Enter the amount of my money: 10023 Your amount is $100.23. My amount is \$100. 23 . Te have the same amounts. Total amount is : 200.46 Enter the amount of your money: 12580 Enter the amount of my money: 13055 Your amount is $125.80. My amount is $130.55. One of us is richer. Total amount is : 256.35
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
