Question
Translate code to english pseudocode #include using namespace std; //Class Section 401k class Section_401k{ //Private attributes. private: float annual_salary; float annual_salary_increase; float annual_rate_of_return; int current_age;
Translate code to english pseudocode
#include
using namespace std;
//Class Section 401k
class Section_401k{
//Private attributes.
private:
float annual_salary;
float annual_salary_increase;
float annual_rate_of_return;
int current_age;
int age_of_retirement;
float current_401k_balance;
float contribution_to_401k;
float employer_match;
float employer_max_contribution;
//Public Functions.
public:
void Input(){
cout<<"annual_salary : ";
cin>>annual_salary;
cout<<"annual_salary_increase : ";
cin>>annual_salary_increase;
cout<<"annual_rate_of_return : ";
cin>>annual_rate_of_return;
cout<<"current_age : ";
cin>>current_age;
cout<<"age_of_retirement : ";
cin>>age_of_retirement;
cout<<"current_401k_balance : ";
cin>>current_401k_balance;
cout<<"contribution_to_401k : ";
cin>>contribution_to_401k;
cout<<"employer_match : ";
cin>>employer_match;
cout<<"employer_max_contribution : ";
cin>>employer_max_contribution;
cout< } void Calculate_UserTAV(){ double YC=0; //Monthly 401k contribution. double EC=0; //Employers 401k Monthly Contribution double CB = current_401k_balance; int n=age_of_retirement - current_age; //Calculate YC and EC YC = floor(annual_salary*1.0*(contribution_to_401k))/(12*100); EC = (1.0 * YC * employer_match)/100; //Calculate Rate double rate = (annual_rate_of_return*1.0)/100; double temp1 = (1.0*rate)/12; double temp2 = pow(temp1 + 1, n*12); //temp2 = (temp1+1)^(n*12) //Calculate TAV using given formula. double TAV=0; TAV = (CB * temp2); TAV = TAV + ((temp1 + 1) * (YC + EC) *1.0* (temp2 - 1)) / temp1; cout<<"annual_salary : "< cout<<"annual_salary_increase : "< cout<<"annual_rate_of_return : "< cout<<"current_age : "< cout<<"age_of_retirement : "< cout<<"current_401k_balance : "< cout<<"contribution_to_401k : "< cout<<"employer_match : "< cout<<"employer_max_contribution : "< cout<<"Total Account Value at age "< } }; //Main Function for Section_401k Class. int main(){ cout << setprecision(2) << fixed; //Make Object "anEmployee". Section_401k anEmployee; anEmployee.Input(); //Take Input anEmployee.Calculate_UserTAV(); //Calculate TAV return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started