Write a program to balance a checkbook. The user enters checks and deposits for the month (checks are entered as negative numbers). The end of the input is indicated by entering 0 as a sentinel value. In addition, the program should implement the following behaviors:
All monetary values should be displayed with exactly two digits after the decimal point. Use cout.width() to help you line up your output. It should look similar to this:
This program helps you balance your checkbook. Enter each check and deposit during the month. To indicate a check, use a minus sign. Signal the end of the month with a 0 value. Enter the initial balance: 189.11 Enter check (-) or deposit: -50 Current balance = 139.11 Enter check (-) or deposit: -23.43 Current balance = 115.68 Enter check (-) or deposit: 287.70 Current balance = 403.38 Enter check (-) or deposit: -15.64 Current balance = 387.74 Enter check (-) or deposit: 0 Number of checks 3 Total check amount 89.07 Number of deposits 1 Total deposit amount 287.70 Minimum balance 115.68 Interest earned 2.31 Final balance 390.05
Create and print two sample runs, using these two sequences of values.
Run 1: 298.79, 210.00, -28.00, -50.00, -59.49, 42.55, -24.66, -49.95