Jacob Weinstein wants a program that displays his savings account balance at the
ID: 3757664 • Letter: J
Question
Jacob Weinstein wants a program that displays his savings account balance at the end of the month, given the balance, total deposits, and total withdraws.
A. Enter the input, processing and output items as well as the algorthim in a chart.
B. Enter the C++ instructions in the second column of the chart.
I am not sure I have my IPO chart correct. Someone please help me get this correct Thanks in advance
Input
Processing
Output
Being balance of savings
Total deposits
Total withdraws
Processing Items:
Algorithm:
Savings account balance
Input
Processing
Output
Being balance of savings
Total deposits
Total withdraws
Processing Items:
Algorithm:
Savings account balance
Explanation / Answer
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double depositAmount;
double withdrawAmount;
int monthPeriod = 1;
double startBalance;
double finalBalance;
double totalBalance;
double annInterestRate;
double monthInterestRate;
double monthInterestAmount;
double monthAverageBalance;
double monthAverageAmount;
int count;
cout << " your starting balance ";
cin >> totalBalance;
cout << your annual rate ";
cin >> annInterestRate;
for (count = 0; count <= monthPeriod; count++)
{
cout << "Enter amount deposited in month ";
cin >> depositAmount;
while (depositAmount < 0)
{
cout << "Negative amonuts ..Error." << endl;
cin >> depositAmount;
}
cout << " total amount withdrawn for the month ";
cin >> withdrawAmount;
while (withdrawAmount < 0 || withdrawAmount > totalBalance)
{
cout << "Withdrawal must not be negative and not greater than current balance of " << endl;
cin >> withdrawAmount;
}
startBalance = totalBalance + depositAmount;
finalBalance = totalBalance - withdrawAmount;
totalBalance = startBalance - finalBalance;
monthInterestRate = annInterestRate * 12;
monthAverageBalance = (startBalance + finalBalance) / 2;
monthInterestAmount = monthAverageBalance * monthInterestRate;
totalBalance = monthInterestAmount + totalBalance;
}
cout << "Your starting balance at the beginning of month " << startBalance << endl;
cout << "Total deposits in month " << depositAmount << endl;
cout << "Total withdrawals month " << withdrawAmount << endl;
cout << "Total interest posted to account for months " << monthInterestAmount << endl;
cout << "savings account Balance: " << totalBalance << endl;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.