quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryعلوم الحاسوب schoolبكالوريوس event_available2026-07-15

السؤال

Transcribed Image Text:

Problem 1 - Calculating Credit Card Balance (10 points) Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month. The following variables contain values as described below: 1. balance the outstanding balance on the credit card 2. annual Interest Rate annual interest rate as a decimal 3. monthlyPayment Rate - minimum monthly payment rate as a decimal For each month, calculate statements on the monthly payment and re- maining balance. At the end of 12 months, print out the remaining bal- ance. Be sure to print out no more than two decimal digits of accuracy - so print Remaining balance: 813.41 instead of Remaining balance: 813.4141998135 So your program only prints out one thing: the remaining balance at the end of the year in the format: Remaining balance: 4784.0 A summary of the required math is found below: Monthly interest rate = (Annual interest rate) / 12.0 Minimum monthly payment = (Minimum monthly payment rate) x (Previous balance) Monthly unpaid balance = (Previous balance) - (Minimum monthly payment) Updated balance each month = (Monthly unpaid balance) + (Monthly interest rate x Monthly unpaid balance) We provide sample test cases in the appendix to this document. We suggest you develop your code on your own machine, and make sure your code passes the sample test cases, before you submit your solution. Appendix Test Cases Test Cases for Problem 1. Be sure to test these on your own machine - and that you get the same output! - before submitting. Test Case 1: balance 42 annual Interest Rate = 0.2 - monthly Payment Rate 0.04 Result Your Code Should Generate Below: Remaining balance: 31.38 To make sure you are doing calculation correctly, this is the remaining balance you should be getting at each month for this example Month 1 Remaining balance: 40.99 Month 2 Remaining balance: 40.01 Month 3 Remaining balance: 39.05 Month Remaining balance: 38.11 Month 5 Remaining balance: 37.2 Month 6 Remaining balance: 36.3 Month 7 Remaining balance: 35.43 Month 8 Remaining balance: 34.58 Month 9 Remaining balance: 33.75 Month 10 Remaining balance: 32.94 Month 11 Remaining balance: 32.15 Month 12 Remaining balance: 31.38 #Test Case 2: balance 484 annual Interest Rate = 0.2 monthlyPayment Rate 0.04 Result Your Code Should Generate Below: Remaining balance: 361.61 Note: Depending on where you round in this problem, your answers may

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top