-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
43 lines (35 loc) · 1.51 KB
/
main.cpp
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
// CS 210 Project Two
// Kaylea Carpenter
// June 8th, 2024
#include <iostream>
#include "Investment.h"
int main()
{
double initialAmount, monthlyDeposit, annualInterestRate;
int years;
std::cout << "***********************************\n";
std::cout << "********* DATA INPUT **************\n";
std::cout << "Initial Investment Amount: ";
std::cin >> initialAmount;
std::cout << "Monthly Deposit: ";
std::cin >> monthlyDeposit;
std::cout << "Annual Interest (%): ";
std::cin >> annualInterestRate;
std::cout << "Number of years: ";
std::cin >> years;
std::cout << "Press any key to continue...";
std::cin.ignore();
std::cin.get(); // Wait for user to press Enter key
Investment investment(initialAmount, monthlyDeposit, annualInterestRate, years);
// Calculate and display growth with deposits
std::cout << "\nYear-end balances and earned interest with monthly deposits:\n";
std::cout << "Year\tBalance\t\tTotal Interest" << std::endl;
std::cout << "-----------------------------------------------" << std::endl;
investment.calculate_growth_with_deposits();
// Calculate and display growth without deposits
std::cout << "\nYear-end balances and earned interest without additional deposits:\n";
std::cout << "Year\tBalance\t\tTotal Interest" << std::endl;
std::cout << "-----------------------------------------------" << std::endl;
investment.calculate_growth_without_deposits();
return 0;
}