SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,julia Lobur
Chapter:
More Flow Of Control
Exercise:
Programming Projects
Question:2 | ISBN:9780321531346 | Edition: 7

Question

Write a program to compute the interest due, total amount due, and the minimum payment for a revolving credit account. The program accepts the account balance as input, then adds on the interest to get the total amount due. The rate schedules are the following: The interest is 1.5% on the first $1,000 and 1% on any amount over that. The minimum payment is the total amount due if that is $10 or less; otherwise, it is $10 or 10% of the total amount owed, whichever is larger. Your program should include a loop that lets the user repeat this calculation until the user says she or he is done.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

Program:


#include
using namespace std;
void main()
{
	double dueCost, dueInterest, minPayment, bal;
	char Continue;
	do	
	{ 
 	 cout<<"Enter bal due: ";
	 cin>>bal;
	 if(bal>1000)
	  dueInterest = ((bal - 1000)*.01 + (1000)*.015);
	 else
	
		dueInterest = bal*.015;
	
		dueCost = bal + dueInterest;

	   minPayment = dueCost<=10? 
    	dueCost : ((dueCost*.1)> 10? (dueCost*.1):10);

	 cout<<"\n Interest on balance: "<>Continue;
	}while(Continue =='y' || Continue =='Y');
 system("pause");
}

Output:

Enter balance due: 5000

 Interest on balance is : 55
 Total amount due is: 5055
 Minimum payment is: 505.5
 To repeat calculations for different variables then press 'y' or 'Y'
y
Enter balance due: 280

 Interest on balance is : 4.2
 Total amount due is: 284.2
 Minimum payment is: 28.42
 To repeat calculations for different variables then press 'y' or 'Y'
n
0 0

Discussions

Post the discussion to improve the above solution.