subject

Create a usmoney class w/ two integer instance variables dollars and cents. add a constructor w/ 2 parameters for initializing a usmoney object. the constructor should check that the cents value is between 0 and 99, if it is not transfer some of the cents to the dollar variable to make it between 0 and 99. add a plus method to the class that takes a usmoney object as its parameter. it creates and returns a new usmoney object representing the sum of the object whose plus() method is being invoked and the parameter. it does not modify the values of the two existing objects. it should also ensure that the value of the cents instance variable of the new object is between 0 and 99. for example, if x is a usmoney object w/ 5 dollars and 80 cents. and y is a usmoney object with 1 dollar and 90 cents. then x. plus(y) will return a new usmoney object with 7 dollars and 70 cents. also create a usmoneydemo class that tests the usmoney class.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:30
Consider the following statements: #include #include class temporary { private: string description; double first; double second; public: temporary(string = "", double = 0.0, double = 0.0); void set(string, double, double); double manipulate(); void get(string& , double& , double& ); void setdescription(string); void setfirst(double); void setsecond(double); }; write the definition of the member function set() so that the instance variables are set according to the parameters. write the definition of the constructor so that it initializes the instance variables using the function set() write the definition of the member function manipulate() that returns a decimal number (double) as follows: if the value of description is "rectangle", it returns first * second if the value of description is "circle" it returns the area of a circle with radius first if the value of description is "cylinder" it returns the volume of a cylinder with radius first and height second. hint: the volume of a cylinder is simply the area of the circle at the base times the height. if the value of description is "sphere" it returns the volume of the sphere with radius first. otherwise it returns -1.0;
Answers: 1
question
Computers and Technology, 22.06.2019 12:00
Which of the following “invisible” marks represents an inserted tab?
Answers: 1
question
Computers and Technology, 22.06.2019 15:20
This os integrated the processing power of windows nt with the easy-to-use gui of windows 98. windows 2000 windows 3.11 windows for workgroups windowa millennium edition
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Which cultural aspect does this type of song best portray? a german polka dance
Answers: 1
You know the right answer?
Create a usmoney class w/ two integer instance variables dollars and cents. add a constructor w/ 2 p...
Questions
question
Mathematics, 20.12.2021 14:00
question
Arts, 20.12.2021 14:00
question
Advanced Placement (AP), 20.12.2021 14:00
question
Mathematics, 20.12.2021 14:00
question
Mathematics, 20.12.2021 14:00
Questions on the website: 13722367