subject

You are to write some overloaded operator methods for coinage objects that keep track of the amount of coins you have. A Coinage class will be used with the following six private data members: integer p for the number of pennies (eg 6)
integer n for the number of nickels (eg 4)
integer d for the number of dimes (eg 3)
integer q for the number of quarters (eg 5)
integer num for the total number of coins (eg 18 (6 + 4 + 3 + 5))
float amt for the total money amount for the coinage (eg 1.81 (6 * .01 + 4 *.05 + 3 * .10 + 5 * .25))
1. Overload the <= operator in the public section. Example: if (c1 <= c2) Your code should return true if the total money amount for c1 is less than or equal to the total money amount for c2.
2. Overload the + operator. Example: total = c1 + c2; Your code should add together the two Coinage objects c1 and c2 and place the total of these two objects into the total object. You will need to add together the corresponding data members and place these sums into total. For example, if c1 has 6 pennies and c2 has 10 pennies, then total has 6 + 10 =16 pennies.
3. Overload the ++ operator (preincrement). Example: ++c1; Your code should add one of each coin type to the c1 object. That is, c1 should have one additional penny, nickel, dime and quarter after the preincrement. Do not forget to recalculate the necessary data members.
4. Overload the ++ operator (postincrement). Example: c1++; Your code should add one of each coin type to the c1 object. That is, c1 should have one additional penny, nickel, dime and quarter after the postincrement. Do not forget to recalculate the necessary data members.
5. Overload the stream extraction operator. Example: cin >> c1;
6. Overload the stream insertion operator. Example: cout << c1;

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 14:10
In a flashdisk wich icon can you use to open files in computer
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
Report all segments of identity by descent longer than 20 polymorphisms between pairs of individuals in the following cohort of 15 individuals across 49 polymorphisms: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 numeric input 2 points possible (graded) you have 2 attempts to complete the assignment below. for example if the sequence is "bcd", which occurs in "abcdef" , the starting point would be 2 (b), and the finishing point would be 4(d). individuals 7,10 between positions
Answers: 1
question
Computers and Technology, 24.06.2019 02:20
Peter is thinking of a number which isless than 50. the number has 9 factors.when he adds 4 to the number, itbecomes a multiple of 5. what is thenumber he is thinking of ?
Answers: 1
You know the right answer?
You are to write some overloaded operator methods for coinage objects that keep track of the amount...
Questions
question
Mathematics, 31.05.2020 15:57
question
Mathematics, 31.05.2020 15:57
Questions on the website: 13722363