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, 22.06.2019 04:30
How can you know if the person or organization providing the information has the credentials and knowledge to speak on this topic? one clue is the type of web site it is--the domain name ".org" tells you that this site is run by a nonprofit organization.
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
Need asap assignment directions: think of an organization (business, religious institution, volunteer organization, sports team) with which you have been involved. imagine outfitting it with an it infrastructure. prepare a plan for what you would do to support outfitting it. draw a map of a network connecting all the individuals, give them pcs and printers, and lay out the design as best you can. the purpose is to begin working with these concepts, not to build a perfect network.
Answers: 2
question
Computers and Technology, 23.06.2019 00:10
Write a function so that the main0 code below can be replaced by the simpler code that calls function mphandminutes tomiles0. original main0 int main) l double milesperhour-70.0; double minutestraveled = 100.0; double hourstraveled; double milestraveled; hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; cout < "miles" 2 using namespace std; 4 /* your solution goes here/ 6 int maino 1 test passed 7 double milesperhour 70.0 all tests passed 8 double minutestraveled 100.0; 10 cout < < "miles: " < < mphandminutestomiles(milesper-hour, minutestraveled) < < endl; 12 return 0; 13
Answers: 1
question
Computers and Technology, 24.06.2019 10:30
Which of the following types of software is most applicable to the promotion of new products through advertising? a.databases b. spreadsheets c. web design programs d. word processing tools
Answers: 2
You know the right answer?
You are to write some overloaded operator methods for coinage objects that keep track of the amount...
Questions
question
Health, 06.11.2020 23:20
question
History, 06.11.2020 23:20
question
Mathematics, 06.11.2020 23:20
Questions on the website: 13722367