#include <iostream.h>

// Object Oriented C++ Lab 2 Program by Jonathan LaZor Room LA 3

class SavingsAccount {
	double savingsBalance;
public:
	static double annualInterestRate;

	SavingsAccount(double inputBalance);
	void calculateMonthlyInterest();
	static void modifyInterestRate(double inputInterestRate);
	double getBalance();
};

double SavingsAccount::annualInterestRate;

//////////

SavingsAccount::SavingsAccount(double inputBalance) {
	savingsBalance = inputBalance;
}

void SavingsAccount::calculateMonthlyInterest() {
	savingsBalance += (savingsBalance * annualInterestRate / 12);
}

void SavingsAccount::modifyInterestRate(double inputInterestRate) {
	SavingsAccount::annualInterestRate = inputInterestRate;
}

double SavingsAccount::getBalance() {
	return savingsBalance;
}

int main() {
	SavingsAccount saver1(2000), saver2(3000);
	SavingsAccount::modifyInterestRate(.03);
	saver1.calculateMonthlyInterest();
	saver2.calculateMonthlyInterest();
	cout << "Account 1 Balance at " << SavingsAccount::annualInterestRate
		<< "% interest: " << saver1.getBalance()
		<< "\nAccount 2 Balance at " << SavingsAccount::annualInterestRate
		<< "% interest: " << saver2.getBalance() << "\n";
	SavingsAccount::modifyInterestRate(.04);
	saver1.calculateMonthlyInterest();
	saver2.calculateMonthlyInterest();
	cout << "Account 1 Balance Next Month at "
		<< SavingsAccount::annualInterestRate
		<< "% interest: " << saver1.getBalance()
		<< "\nAccount 2 Balance Next Month at "
		<< SavingsAccount::annualInterestRate
		<< "% interest: " << saver2.getBalance() << "\n";

	return 1;
}