Question: need parts a through d please Problem 4 (2 points). Design and implement a Money class for calculations involving dollars and cents where arithmetic has

 need parts a through d please Problem 4 (2 points). Design

need parts a through d please

Problem 4 (2 points). Design and implement a Money class for calculations involving dollars and cents where arithmetic has to be accurate to the last cent using the 4/5 rounding rule (.5 of a cent rounds up; anything less than .5 rounds down): (a) Represent a monetary amount as a number of cents in a long, but input and output as dollars and cents, e.g., $123.45. Do not worry about amounts that don't fit into a long. (b) Provide addition (Money + Money), subtraction (Money - Money), multiplication (Money * int or Money * double), and division (Money / int or Money / double) operators. (c) Define corresponding input (>> and output (>) that reads monetary amounts with currency denominations, such as USD 1.23 and EUR 5.00, into a Money variable. Also define a corresponding output operator (

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!