Say that you owe a balance on your credit card. The company charges you 1.5% per month on the unpaid balance. You have decided to stop using the card and to pay off the debt by making a monthly payment of N dollars a month.
Write a program that asks for the beginning balance and the monthly payment.
For each month, first calculate the interest due on the unpaid balance. Then calculate the new balance by adding the interest and subtracting the payment.
Display to the screen the balance and total payments so far for every succeeding month until the balance is paid. When the balance falls below the amount of the monthly payment, determine and display the final payment amount (including the interest) that will bring the balance to exactly zero.
Use a while loop to calculate and display the program output, and declare constants for all fixed values.
Enter the beginning balance:
Enter the monthly payment:
Month Payment Balance Payments
1 100.00 915.00 100.00
2 100.00 828.73 200.00
3 100.00 741.16 300.00
4 100.00 652.28 400.00
5 100.00 562.06 500.00
6 100.00 470.49 600.00
7 100.00 377.55 700.00
8 100.00 283.21 800.00
9 100.00 187.46 900.00
10 100.00 90.27 1000.00
11 91.62 0.00 1091.62
Note that the last payment should not be more than the amount owed.
Your program should include the following user-defined function:
This function will be called twice within the program. The first time it is called, it will read and validate the beginning balance. The second time it is called it will read and validate the monthly payment.
The Fibonacci series of integer numbers is formed by the following rule:
Each number is the SUM of the previous two numbers.
The Fibonacci series can begin with any two integers (positive or negative), so long as the next term is always the sum of the previous 2 numbers.
Interestingly, the sum of the first TEN members of a Fibonacci series is always ELEVEN times the value of the SEVENTH element in the sequence. Your program will prove this is true.
The program should first prompt the user for the first two numbers in the sequence. Accept any non-zero input (positive or negative).
Then, using a for loop, the program will generate each number in the series, keep a running sum, and determine the value of the seventh element. A function will be called each time the code loops, to generate the next number in the sequence.
Finally, the program should display a math equation showing 11 times the 7th element is equal to the sum of the first 10.
Sample Output: If the user enters 20 and 30 as the first 2 numbers:
The first 10 elements of a Fibonacci series
beginning with 20 and 30 are:
20 30 50 80 130 210 340 550 890 1440
The sum of the first 10 elements is: 3740
The seventh element is 340. 11 x 340 = 3740
Your program should include the following functions: