Having alot of trouble with part C of my project. It says Calculate montly interest. monthly int is annual int div by 12. Then Multiply monthly int by balance.
I have to keep a running total of what ever number of months the user enters. I know how to do a simple running total but I dont know how to incorporate it here.
Also I keep getting a very low balance after putting in my info. Any constructive info is appreciated.
// This program calculates the balance of a savings account at the
// end of a period of time. It should ask the user for the annual interest
// rate, the starting balance, and the number of months since the account was
// opened. A loop should iterate once every month.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double aInterest, sBalance,total; // starting balance and annual interest rate
double depositAmount, withDraw;
double mInterest, balance;
int acctAge;
// Ask the user to enter their starting balance.
cout << "What is your starting balance?\n";
cin >> sBalance;
// Ask the user how many months since acct was est.
cout << "How many months have you had this account?\n";
cin >> acctAge;
// Amount despoited during the month
cout << "How much did you deposit this month?\n";
cin >> depositAmount;
while (depositAmount < 0)
{
cout << "You can not enter anything less than zero!\n";
cin >> depositAmount;
}
total = (sBalance += depositAmount);
// Display total thus far
cout << "Your total is " << total << endl;
// Amount withdrawn during the month
cout << "How much have you withdrawn this month?\n";
cin >> withDraw;
while (withDraw < 0)
{
cout << "Enter a number greater than zero.\n";
cin >> withDraw;
}
total = (sBalance -= withDraw);
// Display total thus far
cout << "Your total after deductions is " << total << endl;
I finally got it Mos and thanks for your help. The biggest problem im having with programming is starting and organization. With more complicated programs im not sure what variables to use sometimes or where they would be best used in the program. Sounds funny but thats my biggest issue right now. I read my textbook and understand everything that it is saying but as soon as im given a "program challenge" I have trouble applying what I just learned to writing the program.