## Create a currency class with two integer attributes that are non-public - whole part (or currency note value) and fractional part (or currency coin value) such that 100 fractional parts equals 1 whole part. Write your getters and setters as needed.

### computer science

##### Description

Programming problem: Currency Simulator

A. Create a currency class with two integer attributes that are non-public - whole part (or currency note value) and fractional part (or currency coin value) such that 100 fractional parts equals 1 whole part. Write your getters and setters as needed.

B. Create 5 derived classes for the following currencies - Dollar, Pound, Yen, Rupee and Real. Each derived class should have two non-public string attributes (and related getters and setters) to store the currency note name and currency coin name. Add any other attributes you feel might be useful in the child classes. Your program will get input from the user for adding and subtracting currency items using the form - each in a single line:

• Dollar 1 25 cent
• Pound 3 33 pence
• Yen 100 54 sen
• Rupee 7 11 paise
• Real 50 86 centavo

C. Define 4 overloaded operators in your Currency class as class member functions to add, subtract and compare (any two of >, < or ==) 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. Additionally, you can choose to overload other mathematical or relational operators you like.

D. Define an overloaded input stream operator to accept values of any currency as format outlined in #B above as well as an overloaded output stream operator to write out the value of the currency in the same format. These should be defined as friend functions and you will need to overload them in all your classes as friend methods are not inherited.

E. When initializing currency objects, your code should demonstrate polymorphic construction.  Your constructors should also use initialization lists. Polymorphic construction means using a base class pointer to a dynamically allocated object of the child class.

F. In your main -

• Declare 5 Currency pointers (pDollar, pPound, pYen, pRupee and pReal) and use them to create 0.0 value objects of each of the 5 currencies respectively.
• Then in a loop ask the user (me) for one of four operations - add, subtract, list or end.
• Add and Subtract operations will be followed by a Currency value in the format of #B.
• Perform the addition or subtraction and print the current value of the currency in the format of #B.
• List operation lists the value of all currencies in the program.
• End operation will first list all the currencies and then end the program - remember to take care of all memory leaks before the program ends. Also, put a pause just before the program ends to enable observation of the output.
• Only use a first level menu for the operations above - do not use multi-level menus.

G. DO NOT USE:

• 'using namespace std;' in any other file except the one containing your main,
• 'cin' / 'cout' in any other file except your main,
• inline code in your .h files unless it is no more than 3 lines of code.

Things to remember:

• Make any relevant assumptions that you may need but state them clearly in your name/comment block at the top.
• Remember to document your methods adequately (pre-post headers in your .h files) as well as any other relevant comments. Also, provide necessary pseudocode in the program in the main.
• This program will need individual class declaration and implementation files for the currency classes and a file for your main, though you may combine various currencies into the same set of files.  Simply put - your project will consist of a minimum of one .h and two .cpp files or a maximum of six .h and seven .cpp files.
• Do not write your methods as inline in your class declaration if they will be more than 2 statements - define them in their corresponding cpp files.
1. You are allowed to use any IDE for your programs as long as you follow the submission directions above. However, I will ONLY grade them using Microsoft's Visual Studio 2019 and it is stricter than other compilers about including the right files, especially 'string'.
2. Your zip files should contain only the relevant files and nothing else. This is especially important for Mac users as the zip program on Macs includes hidden folders.
3. Only submissions in ZIP file format will be accepted - no gzip, 7z, tar, rar or any other file format.
4. Not including the name block will result in a 10% penalty.
5. Not including screenshots will result in a 10% penalty.
6. Not including pseudocode will result in a 20% penalty.
7. Not including pre/post headers will result in a 20% penalty.