Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please program the following program in C++ language and include inheritance, overloaded addition, subtraction, comparison, input and output operators for Currency, polymorphic construction of Currency

image text in transcribedimage text in transcribedimage text in transcribed

Please program the following program in C++ language and include inheritance, overloaded addition, subtraction, comparison, input and output operators for Currency, polymorphic construction of Currency objects in the Wallet, overloaded subscript operator in Wallet and in a clear and intuitive user interactivity Please follow these instructions carefully. A. Create a currency class with four attributes - currency note, whole parts and fractional parts and currency coin such that 100 fractional parts equals 1 whole part. B. Create 5 derived classes for the following currencies - Dollar, Euro, Yen, Rupee and Yuan. I know this program can be done without inheritance but it is a requirement for this lab. You will be adding and subtracting currency values using the form: Dollar, 1, 25, cent Euro, 3, 33, cent Yen, 100, 54, sen Rupee, 7, 11, paise Yuan, 50, 86, fen C. Define 3 or 4 overloaded operators to add, subtract and compare different currency objects - care should be taken that you can only perform these operation on objects of the same currency. Also, take care that fractional parts roll into whole parts D. Define an overloaded input stream operator to accept values of any currency as well as an overloaded output stream operator to write out the value of the currency, E. When initializing currency objects, your code should demonstrate polymorphic construction. Your constructors should also use initialization lists. F. Now, define a Wallet class that will contain the 5 individual currency types above and will implement the following - number of individual currency types whose value is non-zero, check if a currency type exists with non-zero value in the wallet, add money by currency type, remove money by currency type zero out all currency types, check if wallet is empty. What this means is that your wallet can only contain one object of each currency type. To add or remove money into/from wallet, check if currency has non- zero value in the wallet. If so, add or remove the amount specified

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions

Question

4. Choose appropriate and powerful language

Answered: 1 week ago

Question

2. Choose an appropriate organizational pattern for your speech

Answered: 1 week ago