Question
Creating objects of the Currency class require a name (string), a currency symbol (string) and the number of decimal places (integer) usually associated with the currency (in that order). Creating objects of the Money class require a Currency object, and the actual amount (integer) (in that order). Define an object of type Currency named canadianDollars and corresponding to the name "Canadian Dollar", the symbol "C$", and 2 decimal places. Define an object of type Money named valueInCanadians corresponding to 230 units of canadianDollars.
Solution
Currency canadianDollars ("Canadian Dollar", "C$", 2);
Money valueInCanadians (canadianDollars,230);
Answers for C++ Course using "Starting out with C++ : from control structures through objects" by Tony Gaddis. 7/8th ed. I used the Pearson myprogramminglab to complete the homework. Here are my solutions/answers for the exercises/labs so please use the test bank as a GUIDE if you're stuck. Let me know if you find a better solution to a problem or any of the programming challenges. Thanks in advance for your support! Send in missing programming challenges to cplusplus.answers@gmail.com
No comments:
Post a Comment