Question: C# Programming (NO HARCODE PLEASE) Create a Money class that has as data members dollars and cents. Include IncrementMoney and DecrementMoney instance methods. Include constructors

C# Programming (NO HARCODE PLEASE)

Create a Money class that has as data members dollars and cents. Include IncrementMoney and DecrementMoney instance methods. Include constructors that enable the Money class to be instantiated with a single value representing the full dollar/cent amount as well as a constructor that enables you to create an instance of the class by sending two separate integer values representing the dollar and cent amounts. Include an instance method that returns as a string the num- ber of dollars, quarters, nickels, dimes, and pennies represented by the objects value. Override the ToString( ) method to return the monetary amount formatted with currency symbols. Create a second class called MoneyApp to test your Money class.

Output:

Original Amount 5 Dollars 36 Cents

Enter decrement amount Enter the full dollar amount and cent amount: 2.36

Decrement Test

Original Amount: $5.36

Amount to subtract: 2.36

New Dollar Amount: 3.00

New Cent Amount: .0

New Full Amount: $3.00

Press any key to see the next test

Second Test:

Next Money Value: $4.02

Enter Increment amount (with decimal for cents).

Enter the full dollar and cent amount: 0.98

Second Test:

Original Amount 4 dollars 2 cents

Increment Test

Amount to Add: 0.98

New Amount: $5.00

Press any key to see the next test

Third Test input dollars and cents as separate values:

Enter Dollars: 7

Enter Cents as a whole number: 35

Full Dollar Amount:

Amount: $7.35

Press any key to see the next test

Enter the full dollar and cent amount: 11.65

Dollars: 11

Quarters: 2

Dimes: 1

Nickels: 1

Pennies: 0

Press any key to see the next test

Last Test Enter the monetary amount as a single value (with a decimal):

Enter the full dollar and cent amount: 9.3

Dollars: 9.00

Cents: .30

Amount: $9.30

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!