Question: Please help me as soon as possible. C++ program language Programming problem: Currency Simulator A. Create a USD currency class with two integer attributes and
Please help me as soon as possible.
C++ program language
Programming problem: Currency Simulator
A. Create a USD currency class with two integer attributes and one string attribute, all of which are non-public. The int attributes will represent whole part (or currency note value) and fractional part (or currency coin value) such that 100 fractional parts equals 1 whole part. The string attribute will represent the currency name.
B. Create a C2D derived/inherited class with one additional non-public double attribute to represent the conversion factor from/to US Dollar.
- The value of the conversion factor can be defaulted in the class definition based on 1 USD = 1.36 C2D or 1 C2D = 0.74 USD.
C. In your two currency classes, add public methods for the following:
- Default Construction (i.e. no parameters passed)
- Construction based on parameters for all attributes
- Copy Constructor and/or Assignment, as applicable to your programming language of choice
- Destructor, as applicable to your programming language of choice
- Setters and Getters for all attributes
- Adding two objects of the same currency
- Subtracting one object from another object of the same currency
- Comparing two objects of the same currency for equality/inequality
- Comparing two objects of the same currency to identify which object is larger or smaller
- Print method to print details of a currency object
- In your derived class only, methods to convert USD objects to C2D and vice versa
D. Create a Wallet class with one attribute - an array of two USD references / pointers and the following methods to demonstrate polymorphism of the currencies:
- A default Constructor which sets
- the first element of the array to a zero value USD object
- the second element of the array to a zero value C2D object
- A Destructor, as applicable to your programming language of choice
- Methods to add or subtract currency objects appropriately using USD references / pointers, i.e.
- USD objects to/from the first element only and
- C2D objects to/from the second element only
- Do not write currency specific add/subtract methods as that would defeat the purpose of polymorphism.
- Methods to compare if the value of either element is greater or smaller than an input value using USD references only. This method can be called upon in the subtract method above as needed.
- A method to Print the values of the two elements in the Wallet
E. In your main:
- Create a Wallet object
- Provide the user a main menu to add/ subtract/ compare the USD and C2D values in the Wallet as well as print the contents of the Wallet
- You can use a second level menu choice to allow the user to select currency type
- Based on user choice, create either USD or C2D objects as needed to perform the desired operations.
- The main menu should be run in a loop until the user selects the Exit option
- There is no sample output - you are allowed to provide user interactivity as you see fit and programs will be graded for clarity of interaction
Things to remember:
- Create appropriately named code files - for the two Currency classes, for the Wallet class and any other helper code you might need.
- The file for your main should be named Lab1Main with the appropriate extension.
- Make any relevant assumptions that you may need but state them clearly in the corresponding code file.
- Remember to document your methods adequately - pre-post headers as well as any other relevant comments. Also, provide necessary pseudocode of the program in the main.
- Also, remember to include name blocks in all the code files.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
