Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Credit Card Interest (Booleans and Conditionals) Summary Write a program that calculates the monthly interest charge on a credit card. The project must be named

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Credit Card Interest (Booleans and Conditionals) Summary Write a program that calculates the monthly interest charge on a credit card. The project must be named A02, and the program named Credit Card Interest. This assignment will help you practice the following concepts: Conditionals (if, and if-else statements) The use of Boolean operators String comparison The exit method Details Credit cards charge interest on "outstanding" balances. That is, if you pay the full balance when it is due, there's no interest to be paid. But if you pay only part of the balance, then interest is charged on the part you did not pay. This program allows the user to calculate what (if any!) interest needs to be paid. 1. Your program starts by identifying itself and you (its author). 2. It then asks the user whether they paid their balance off in full. If the user answers "yes" (or "YES" or "Yes" or "Es" or .) then the program congratulates them on handling credit wisely and then exits. The command to get the program to exit is System.exit(0). You just need to put it in the right place. (The remaining steps below assume that the user did not pay in full, and so the program did not exit.) 3. It then asks the user to input the following: o the balance, how many days before the end of the billing cycle the last payment was made, o the amount paid then, and the annual interest rate (in percent). 4. Your program then checks its input. It is looking for the following conditions: The balance must be a positive number (not equal to zero). The payment day is a number between 1 and the length of the billing cycle. The payment amount must be positive and less than or equal to the balance. o The annual interest rate is either 17.0 or 18.5 percent. (The length of the billing cycle is 31 days. That is fixed by the program, not entered by the user.) Hint: Make a boolean variable for each of those conditions. It will make the next step easier! 5. If any of the conditions is false, then your program prints a warning message that includes all of the input data and the rule that applies to that data (even if the data was correct). (See the sample output 4.) 6. Otherwise the program does the interest calculation and reports the result. Use the following algorithm to calculate the interest charge: 1. Multiply the net balance shown on the statement by the number of days in the billing cycle. 2. Multiply the net payment received by the number of days the payment was received before the statement date. 3. Subtract the result of the calculation from step 2 from the result of the calculation in step 1 of doen in the hillin male Thin 4 Niide the left... Use the following algorithm to calculate the interest charge: 1. Multiply the net balance shown on the statement by the number of days in the billing cycle. 2. Multiply the net payment received by the number of days the payment was received before the statement date. 3. Subtract the result of the calculation from step 2 from the result of the calculation in step 1. 4. Divide the result of step 3 by the number of days in the billing cycle. This is the average daily balance. 5. Compute the interest charge for the billing period by multiplying the average daily balance by the monthly interest rate. Note: The monthly interest rate is 1/12 of the annual interest rate. The following example illustrates how the algorithm works. Suppose the credit card statement showed a balance of $750. Ten days before the end of the billing cycle the credit card owner made a payment of $200. The billing cycle for this month is 31 days, and the annual interest rate is 18.5%. The calculation of the interest charge is as follows: 1.8750 31 = S23250 2. S200 10 = $2000 3. $23250 - $2000 - $21250 4. S21250 + 31 - $685.48 5. 5685.48 * 18.5 + 12 + 100 = $10.57 Note: you should introduce some variables to make your program clear. Please find below a few sample outputs. Sample Output Credit Card Interest This program calculates how much interest you need to pay on your credit card balance. by Jiju Poovvancheri (A00000000) Did you pay your balance in full and on time? (please answer YES or NO): yes Congratulations on paying the full amount! No interest will be charged on your card. Thank you for using the Credit Card Interest Calculator! Your system will now exit. Sample Output2 Credit Card Interest This program calculates how much interest you need to pay on your credit card balance. by Jiju Poovvancheri (A00000000) Did you pay your balance in full and on time? (please answer YES or NO): YES Congratulations on paying the full amount! No interest will be charged on your card. Thank you for using the Credit Card Interest Calculator! Your system will now exit. Sample Output3 Credit Card Interest This program calculates how much interest you need to pay on your credit card balance. by Jiju Poovvancheri (A00000000) Did you pay your balance in full and on time? (please answer YES or NO): no Please enter the previous balance on your credit card: 700 How many days before the end of the cycle did you pay? 10 How much was paid then? 250.50 What is the interest rate of your credit card? 17.0 ......calculating...... The interest charge on your credit card is $8.771908602150537 Thank you for using the Credit Card Interest Calculator

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions