I need help with making this c++ code compile. It's due soon #include #include using namespace std; class Employee{ public: string name; string title; double wages void setName(string n) { name = n; } string getName() { return name; } void settitle(string t) { title = t; } string gettitle() { return title; } void setpayment(double w) { wages = w; } double getpayment() { return wages; } private: string name; string title; double wages; }; int main(){ vectorInfo; Employee E1("Aaron Ramsdale","Goalkeeper",60.1); Employee E2("Bukayo Saka","Winger",60.3); Employee E3("Gabriel Jesus","Forward",120.9); Employee E4("Gabriel Martinelli","Winger",75.4); Employee E5("Martin Odeggard","Midfielder",110.5); Employee E6("Granit Xhaka", "Midfielder",100.3); Employee E7("Thomas Partey","Midfielder",180.1); Employee E8("Olexandr Zinchenko","Defender",120.2); Employee E9("Gabriel Maghaeles","Defender",100.3); Employee E10("Willam Saliba","Defender",45.4); Employee E11("Ben White","Defender",110.5); Info.push_back(E1); Info.push_back(E2); Info.push_back(E3); Info.push_back(E4); Info.push_back(E5); Info.push_back(E6); Info.push_back(E7); Info.push_back(E8); Info.push_back(E9); Info.push_back(E10); Info.push_back(E11); int hours =0; vectorTotal(11); cout << "Welcome, this app helps to locate employee info and calculate your total wages. The options are shown below." << endl; int choice = 0; while(true){ cout<<"1. Print list of employees"<> choice; cout<<". "<> hours; double income = hours * Info.at(i).getpayment(); totalwage.at(i)= income; } } if (choice == 3){ cout<< "You are leaving the app."<< endl; } } return 0; } Question The program presents the user with several options: Print list of employees Calculate total wages Exit application The user will select one of these options by entering the option's enumerated value (i.e., enter 2 to calculate total wages). The "Print list of employees" should print each employee name, job title, and associated hourly wages. The "Calculate total wages" option will iterate through each employee and ask the user to input the total number of hours worked for each employee, multiplying that by the employee's hourly wages, and adding that to the total. After iterating through all employees, the total wages for that week should be displayed. The "Exit application" will break the application out of its main loop and exit the program.
I need help with making this c++ code compile. It's due soon
#include<iostream>
#include<
using namespace std;
class Employee{
public:
string name;
string title;
double wages
void setName(string n)
{
name = n;
}
string getName()
{
return name;
}
void settitle(string t)
{
title = t;
}
string gettitle()
{
return title;
}
void setpayment(double w)
{
wages = w;
}
double getpayment()
{
return wages;
}
private:
string name;
string title;
double wages;
};
int main(){
vector<Employee>Info;
Employee E1("Aaron Ramsdale","Goalkeeper",60.1);
Employee E2("Bukayo Saka","Winger",60.3);
Employee E3("Gabriel Jesus","Forward",120.9);
Employee E4("Gabriel Martinelli","Winger",75.4);
Employee E5("Martin Odeggard","Midfielder",110.5);
Employee E6("Granit Xhaka", "Midfielder",100.3);
Employee E7("Thomas Partey","Midfielder",180.1);
Employee E8("Olexandr Zinchenko","Defender",120.2);
Employee E9("Gabriel Maghaeles","Defender",100.3);
Employee E10("Willam Saliba","Defender",45.4);
Employee E11("Ben White","Defender",110.5);
Info.push_back(E1);
Info.push_back(E2);
Info.push_back(E3);
Info.push_back(E4);
Info.push_back(E5);
Info.push_back(E6);
Info.push_back(E7);
Info.push_back(E8);
Info.push_back(E9);
Info.push_back(E10);
Info.push_back(E11);
int hours =0;
vector<double>Total(11);
cout << "Welcome, this app helps to locate employee info and calculate your total wages. The options are shown below." << endl;
int choice = 0;
while(true){
cout<<"1. Print list of employees"<<endl;
cout<<"2. Calculate total wages"<<endl;
cout<<"3. Exit application"<<endl;
cin >> choice;
cout<<". "<<endl;
if (choice == 1){
for int(i=0; i < Info.size(); i++){
cout<< Info.at(i). getname()<< "," << Info.at(i).gettitle()<<","<<Info.at(i).getpayment()<<endl;
}
}
if (choice == 2){
for int(i = 0; i< Info.size();i++){
cout<< "Enter number of hours worked"<< Info.at(i). getname()<<;
cin >> hours;
double income = hours * Info.at(i).getpayment();
totalwage.at(i)= income;
}
}
if (choice == 3){
cout<< "You are leaving the app."<< endl;
}
}
return 0;
}
Question
The program presents the user with several options:
Print list of employees
Calculate total wages
Exit application
The user will select one of these options by entering the option's enumerated value (i.e., enter 2 to calculate total wages).
The "Print list of employees" should print each employee name, job title, and associated hourly wages.
The "Calculate total wages" option will iterate through each employee and ask the user to input the total number of hours worked for each employee, multiplying that by the employee's hourly wages, and adding that to the total. After iterating through all employees, the total wages for that week should be displayed.
The "Exit application" will break the application out of its main loop and exit the program.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps