Write a program to compute and output the penalty on an unpaid credit card balan
ID: 3732930 • Letter: W
Question
Write a program to compute and output the penalty on an unpaid credit card balance. Assume the interest rate is 1.5% per month. Declare variables and add header Enter the current balance and payment Final balance-current balance payment Is the final balance 0? Penalty-final balance'interest rate False Print the final balance and penalty Program: #include "stdafx.h" #include using namespace std; #include int tmain(int argc, _TCHAR* argv[]) //1) declare variales //2) prompt input //3) calculation //4)display the results system("pause"); return eExplanation / Answer
#include "stdafx.h"
#include<iostream>
using namespace std;
#include<iomanip>
int_tmain(int argc, _TCHAR* argv[])
{
//1.declare variable
float currbalance=0;
float payment=0;
float finalbalance=0;
float panelty=0;
float intrestrate = 1.5;
//2.prompt input
printf(" enter the current balance");
scanf("%f",&currbalance);
printf(" enter the payment");
scanf("%f",&payment);
//3.calculation
finalbalance = currbalance - payment;
if(finalbalance > 0)
{
panelty = finalbalance*(intrestrate/100);
}
//4.display the result
printf(" Your Final Balance is = %f",finalbalance);
printf(" Your panelty is = %f",panelty);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.