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 23:00
Explain briefly why you cannot expect to find a previous version of every file with which you work.
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
Why is hard disk space important to an audio engineer? why are usb ports and firewire ports useful for an audio engineer? explain in 2-3 sentences. (3.0 points) here's a list of different audio software: ableton live apple inc.'s garageband apple inc.'s logic studio digidesign's pro tools propellerhead sofware's reason sony creative software's acid pro steinberg cubase steinberg nuendo choose one of the software programs listed above, and then go to that software program's web site. read about what the software program is used for, and then write 4-5 sentences about what you learned. (10.0 points) which type of software license is the most limiting? why? explain in 2-3 sentences. (3.0 points) when sending a midi channel voice message, how can you control the volume of the sound? explain in 2-3 sentences. (4.0 points)
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
Answers: 2
question
Computers and Technology, 24.06.2019 11:20
William travels a lot on business purpose. he needs to regularly communicate with his business partner. he also needs to send out weekly reports to his boss while he is traveling. which web-based application best suits william’s needs? (social media, webmail, wiki) is the best web-based application for william. he can access this application via the internet using a (digital cable, fax machine, web browser).
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
English, 25.10.2020 04:00
question
Mathematics, 25.10.2020 04:00
question
English, 25.10.2020 04:00
question
Chemistry, 25.10.2020 04:00
question
Business, 25.10.2020 04:00
Questions on the website: 13722363