subject

Convert the follwoing code into a object-oriented programming (OOP) application using secure and efficient C++ code. #include
#include
using namespace std;
int main()
{
float inital_Inv;
float month_Dep;
float annual_Int;
float num_Years;
float total_Ammt;
float int_Amunt;
float year_Inest;

try {

cout << "" << endl;
cout << "Data Input" << endl;
cout << "Initial Investment Amount: $ ";
cin >> inital_Inv;

cout << "Monthly Deposit: $ ";
cin >> month_Dep;
cout << "Annual Interest: % ";
cin >> annual_Int;
cout << "Number of years: ";
cin >> num_Years;
}
catch (float x) {

}

total_Ammt = inital_Inv;

cout << "\tBalance and Interest Without Additional Monthly Deposits" << endl;
cout << "" << endl;
cout << "Year\t\tYear End Balance\tYear End Earned Interest" << endl;
cout << "" << endl;

for (int i = 0; i < num_Years; i++) {

int_Amunt = (total_Ammt) * ((annual_Int / 100));

total_Ammt = total_Ammt + int_Amunt;

cout << (i + 1) << "\t\t" << fixed << setprecision(2) << "$" << total_Ammt << "\t\t\t\t" << "$" << int_Amunt << "\n";
}

total_Ammt = inital_Inv;
cout << "\n\n\tBalance and Interest With Additional Monthly Deposits\n";
cout << "\n";
cout << "Year\t\tYear End Balance\tYear End Earned Interest\n";
cout << "\n";

for (int i = 0; i < num_Years; i++) {
year_Inest = 0;
for (int j = 0; j < 12; j++) {

int_Amunt = (total_Ammt + month_Dep) * ((annual_Int / 100) / 12);

year_Inest = year_Inest + int_Amunt;

total_Ammt = total_Ammt + month_Dep + int_Amunt;
}
cout << (i + 1) << "\t\t" << fixed << setprecision(2) << total_Ammt << "\t\t\t\t" << year_Inest << "\n";
}
return 0;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:30
What are compression artifacts? 1) visible defects in the picture caused by the nature of the compression algorithm. 2) numbers that tell a web server how much to compress a picture for faster transmission. 3) invisible defects in the picture preserved by lossless compression. 4) numbers that tell a photo editing program how much to compress a picture for faster transmission.
Answers: 3
question
Computers and Technology, 22.06.2019 04:30
How can you know if the person or organization providing the information has the credentials and knowledge to speak on this topic? one clue is the type of web site it is--the domain name ".org" tells you that this site is run by a nonprofit organization.
Answers: 2
question
Computers and Technology, 24.06.2019 04:30
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe and
Answers: 1
question
Computers and Technology, 24.06.2019 16:50
How many types of string types does python support?
Answers: 1
You know the right answer?
Convert the follwoing code into a object-oriented programming (OOP) application using secure and eff...
Questions
question
Spanish, 25.08.2020 14:01
question
Mathematics, 25.08.2020 14:01
Questions on the website: 13722362