Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help in C++ Open up CodeBlocks and create a new C++ file called salary.cp

ID: 3854081 • Letter: I

Question

I need help in C++

Open up CodeBlocks and create a new C++ file called salary.cpp. Copy and paste the starter code below into the file. NOTE: Do not change the starter code! All you need to do is add to it. Name Section include kiostream include kiomanip using namespace std; //write your functions here int main int hours double hourly wage; double weekly salary double monthly salary double yearly salary 0; cout This program will calculate your weekly, monthly and yearly salary An cout Please enter your hourly wage "i cin hourly wage; cout Please enter the number of hours you work each week "i cin hours; //call functions below

Explanation / Answer

#include <iostream>

using namespace std;
double getWeeklySalary(double wages, int hours){
return wages * hours;
}
double getMonthlySalary(double wages, int hours){
return getWeeklySalary(wages, hours) * 4;
}
double getYearlySalary(double wages, int hours){
return getWeeklySalary(wages, hours) * 50;
}
int main()
{
int hours;
double hourly_wages;
double weekly_salary;
double monthly_salary;
double yearly_salary;

cout<<"The program will calculate weekly, monthly and yearly salary."<<endl;
cout<<"Please enter your hourly wages: ";
cin >> hourly_wages;
cout<<"Please enter number of hours you work each week: ";
cin >> hours;

weekly_salary = getWeeklySalary(hourly_wages, hours);
monthly_salary = getMonthlySalary(hourly_wages, hours);
yearly_salary = getYearlySalary(hourly_wages, hours);

cout<<"You make $"<<weekly_salary<<" per week."<<endl;
cout<<"You make $"<<monthly_salary<<" per month."<<endl;
cout<<"You make $"<<yearly_salary<<" per year."<<endl;

return 0;
}

Output:

sh-4.2$ g++ -o main *.cpp                                                                                                                                                                                                                                              

sh-4.2$ main                                                                                                                                                                                                                                                           

The program will calculate weekly, monthly and yearly salary.                                                                                                                                                                                                          

Please enter your hourly wages: 15                                                                                                                                                                                                                                     

Please enter number of hours you work each week: 40                                                                                                                                                                                                                    

You make $600 per week.                                                                                                                                                                                                                                                

You make $2400 per month.                                                                                                                                                                                                                                              

You make $30000 per year.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote