Compound Interest: Write a C++ program that will CALCULATE and print the balance
ID: 2988971 • Letter: C
Question
Compound Interest: Write a C++ program that will CALCULATE and print the balance in a bank account at a given annually-compounded interest rate, for a given number of years. It should prompt the user for initial balance, interest rate, and number of years. IF THE USER ENTERS INVALID DATA (like "whatever" instead of a number), THE PROGRAM SHOULD WARN THE USER AND QUIT.
Explanation / Answer
#include using namespace std; int main() { double monthlyPayment; double balance; double interestRate; cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); cout > balance; cout > interestRate; cout > monthlyPayment; while (interestRate >= 1) { interestRate = interestRate / 100; } balance = balance * (1 + interestRate / 12) - monthlyPayment; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.