Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me on this c++ program: Create a currency class, up to 5 individual currencies, with four attributes - currency name, whole parts and

Please help me on this c++ program:

Create a currency class, up to 5 individual currencies, with four attributes - currency name, whole parts and fractional parts and fractional's name such that 100 fractional parts equals 1 whole part, e.g. Pound, 1, 55, pence or Euro, 3, 33, cent.

Define overloaded operators to add or subtract 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.

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..

Initialize your currency objects demonstrating polymorphic construction. Your constructors should also use initialization lists.

Define a Wallet class that will contain the 5 individual currency types you define and will implement the following - number of individual currency types, check if a currency type exists in the wallet, add money by currency, remove money by currency, remove all currencies, check if wallet is empty.

To add or remove money into/from wallet, check if currency exists in the wallet. If so, add or remove the amount specified.

Your main should allow the user to add a maximum of 5 different currency types to the wallet in the form of the base currency array - some examples are Dollar and cent, Euro and cent, Pound and pence, Ruble and kopeck. Then use a random number generator to add and remove currency values between 0 and 99 for both the whole and fractional values. You can think about using ENUMs for the currency types to be generated. Finally, output the total value and name of the currencies in your wallet. Finally empty the wallet and print relevant information about the operation.

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

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions

Question

What does a factor model say about equilibrium in the marketplace?

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago