01-20-2011, 05:02 PM
[FONT="]Problem Statement: [/FONT][FONT="]Price manipulation[/FONT][FONT="][/FONT]
[FONT="] [/FONT]
[FONT="]You are required to create a class in C++ named Price with the following Data members, Data members should be publicly declared.[/FONT]
[FONT="] [/FONT]
[FONT="]The Price class presents Price in Rupees and Paisa. For instance, Price (10, 80) means 10 rupees and 80 paisas. The Price class should have the following features as described in detailed descriptions: [/FONT]
[FONT="]Detailed Description:[/FONT]
[FONT="]Constructors[/FONT]
[FONT="] [/FONT]
[FONT="]Class Price must have [/FONT]
[FONT="] [/FONT]
[FONT="]There should be an overloaded + operators:[/FONT]
[FONT="] [/FONT]
[FONT="] [/FONT]
[FONT="]Output of your program should be as follows:[/FONT]
[FONT="] [/FONT]
[FONT="]Price is 10 rupees and 60 paisas[/FONT]
[FONT="] [/FONT]
[FONT="]Price is 12 rupees and 80 paisas [/FONT]
[FONT="] [/FONT]
[FONT="]After Addition [/FONT]
[FONT="] [/FONT]
[FONT="]Price is 23 rupees and 40 paisas[/FONT]
[FONT="] [/FONT]
[FONT="]You are required to create a class in C++ named Price with the following Data members, Data members should be publicly declared.[/FONT]
[FONT="] [/FONT]
- [FONT="]Rupees[/FONT]
- [FONT="]Paisas [/FONT]
[FONT="]The Price class presents Price in Rupees and Paisa. For instance, Price (10, 80) means 10 rupees and 80 paisas. The Price class should have the following features as described in detailed descriptions: [/FONT]
[FONT="]Detailed Description:[/FONT]
[FONT="]Constructors[/FONT]
[FONT="] [/FONT]
[FONT="]Class Price must have [/FONT]
[FONT="] [/FONT]
- [FONT="]Default constructor, which must set Rupees and Paisas to zero.[/FONT]
- [FONT="]Parameterized constructor that receives two parameters of type int and initializes its private data: Rupees and Paisas with them. Note that if Paisas are 100 or greater than 100 then also convert it in Rupees.[/FONT]
- [FONT="]Create a function named Print()that [/FONT][FONT="]displays the price of object in terms of rupees and paisas.[/FONT]
- [FONT="]A [/FONT][FONT="]member function that overloads the + Operator to add two objects of Price. [/FONT]
[FONT="]There should be an overloaded + operators:[/FONT]
[FONT="] [/FONT]
- [FONT="]Add two objects and return Price object. Note that Paisas should not exceed 100. [/FONT]
- [FONT="]Add first number into second objects and return Price object. Note that paisas should not exceed 100.[/FONT]
[FONT="] [/FONT]
[FONT="]Output of your program should be as follows:[/FONT]
[FONT="] [/FONT]
[FONT="]Price is 10 rupees and 60 paisas[/FONT]
[FONT="] [/FONT]
[FONT="]Price is 12 rupees and 80 paisas [/FONT]
[FONT="] [/FONT]
[FONT="]After Addition [/FONT]
[FONT="] [/FONT]
[FONT="]Price is 23 rupees and 40 paisas[/FONT]
