Investment amount, annual interest rate, months

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>

using namespace std;

int main()
{
   double investmentAmount;
   double interestRate;
   double months;
   double monthlyInterest;
   double interestEarned;
   double total;
   
   cout << "The minimum investment is $10,000.00." << endl;
   cout << "Enter the amount of the investment: ";
   cin >> investmentAmount;
   
   if (investmentAmount < 10000.00)
   {
      cout << "Error, the minimum investment is $10,000.00." << endl;
      cout << "Enter the amount of the investment: ";
      cin >> investmentAmount;
   }
   
   cout << "Enter the annual interest rate: ";
   cin >> interestRate;
   
   if (interestRate < 0)
   {
      cout << "Error, the interest rate should be positive." << endl;
      cout << "Enter the annual interest rate: ";
      cin >> interestRate;
   }
   
   cout << "Enter the number of months of the investment: ";
   cin >> months;
   
   if (months < 0)
   {
      cout << "Error, the number of months should be positive." << endl;
      cout << "Enter the number of months of the investment: ";
      cin >> months;
   }
   
   monthlyInterest = ((interestRate / 12.0) / 100.0);
   
   interestEarned = (investmentAmount * monthlyInterest);
   
   total = (investmentAmount + interestEarned);
   
   cout << "After 12 months your investment of $" << investmentAmount << " will be worth $" << total << "." << endl;
   
   return 0;
} // end function main.           


Ask the user for the amount of the investment
Get a minimum investment amount of $10,000 from the user
Ask the user for the annual interest rate
Get a non-negative annual interest rate from the user
Ask the user for the months of the investment
Get a non-negative number of months from the user
Calculate the monthly interest rate by dividing the annual interest rate by 12 and then dividing the resulting value by 100
Save the initial investment amount in investment balance
Repeat for the number of months of the investment
Calculate the interest earned by multiplying the investment balance by the monthly interest rate
Increase the value in the investment balance by the interest earned
Display a message indicating the future value of the investment stored in investment balance

I have everything working except finding the interest earned and calculating the monthly interest rate.
Topic archived. No new replies allowed.