Question

C/C++

Programming problem: Currency Simulator A. Create a USD currency class with two integer attributes and one string attribute, all of which are non-public(Python programmers - it is understood that there is nothing private in Python but try to not access the attributes directly from outside the classes).The int attributes will represent whole part (or currency note value) and fractional part (or currency coin value) such that 100 fractional parts equals 1whole part.The string attribute will represent the currency name. B. Create a C2Dderived/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 C2Dobject 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 C2Dobjects 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 pseudo code of the program in the main. See Design Tools and Documentation.pdf Preview the document for documentation help. Also, remember to include name blocks inall the code files.Grading: 25 pts - program as compiled by me from your code works as outlined above without needing any code change 20 pts - for the USD class 15 pts - for the C2D class and proper demonstration of polymorphism 15 pts - for the Wallet class and proper use of Currency polymorphism in your Wallet 25 pts -the main program including clear and intuitive interactivity


Answer

Verified

Submit query

Getting answers to your urgent problems is simple. Submit your query in the given box and get answers Instantly.

Submit a new Query

Please Add files or description to proceed

Success

Assignment is successfully created