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 transcribed

image 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. G.Your main should pre-define the 5 different currency types as specified above in the wallet in the form of the base currency array of zero values -this will help you demonstrate the polymorphic construction. Demonstrate the overloaded subscript operator for the Wallet class. User should be able to add or remove as many currency values for any of the five currency types. The user should also be able to output the total value by name of the currencies in the wallet. Finally they should be able to empty the wallet and print relevant information about the operation. User Interactivity is extremely important - give due consideration to it

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

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions

Question

Discuss the goals of financial management.

Answered: 1 week ago

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago