6.4k views
2 votes
Create a program that gets information from the owner and displays the current month’s expense for the employee’s wages. Requirements: No loops or decision structures at this point Input comes from the keyboard when the owner enters the monthly data A month is 4 weeks Employees get paid once a month No taxes are taken out, currently it’s the employees job to do All of the input will be finished before the output begins The input: The owner should know which employee and week he is entering the information for Hourly:

User Jesi
by
4.2k points

1 Answer

6 votes

Answer:

The code is in the explanation section below.

The sample output is

Espresso Yourself's Coffehouse

------------------------------

Enter details for Hourly employees:

Darren Duchesne:

Pay per hour: 6.45

Hours worked: Week 1: 35

Week 2: 35

Week 3: 35

Week 4: 35

Christian Cargile:

Pay per hour: 5.75

Hours worked: Week 1: 30

Week 2: 30

Week 3: 30

Week 4: 30

Selena Dresher:

Pay per hour: 6.25

Hours worked: Week 1: 30

Week 2: 30

Week 3: 30

Week 4: 30

Neil Palafox:

Pay per hour: 5.45

Hours worked: Week 1: 32

Week 2: 32

Week 3: 32

Week 4: 32

Salaried Employees:

Emilia Rogge:

Pay per annum: 32633

Weeks worked: 4

Jamie Lanphear:

Pay per annum: 27800

Weeks worked: 4

Step-by-step explanation:

#include <bits/stdc++.h>

using namespace std;

struct employee{

string first_name, last_name;

int hours[4], weeks;

int total_hours;

double hour_pay;

double salary;

} emp[100];

int main()

{

emp[0].first_name = "Darren";

emp[0].last_name = "Duchesne";

emp[1].first_name = "Christian";

emp[1].last_name = "Cargile";

emp[2].first_name = "Selena";

emp[2].last_name = "Dresher";

emp[3].first_name = "Neil";

emp[3].last_name = "Palafox";

emp[4].first_name = "Emilia";

emp[4].last_name = "Rogge";

emp[5].first_name = "Jamie";

emp[5].last_name = "Lanphear";

cout<<"Espresso Yourself's Coffehouse\\";

cout<<"------------------------------\\";

cout<<"Enter details for Hourly employees: \\";

cout<<emp[0].first_name<<" "<<emp[0].last_name<<":\\";

cout<<"Pay per hour: ";

cin >> emp[0].hour_pay;

cout<<"Hours worked: ";

cout<<"Week 1: ";

cin >> emp[0].hours[0];

cout<<"Week 2: ";

cin >> emp[0].hours[1];

cout<<"Week 3: ";

cin >> emp[0].hours[2];

cout<<"Week 4: ";

cin >> emp[0].hours[3];

cout<<emp[1].first_name<<" "<<emp[1].last_name<<":\\";

cout<<"Pay per hour: ";

cin >> emp[1].hour_pay;

cout<<"Hours worked: ";

cout<<"Week 1: ";

cin >> emp[1].hours[0];

cout<<"Week 2: ";

cin >> emp[1].hours[1];

cout<<"Week 3: ";

cin >> emp[1].hours[2];

cout<<"Week 4: ";

cin >> emp[1].hours[3];

cout<<emp[2].first_name<<" "<<emp[2].last_name<<":\\";

cout<<"Pay per hour: ";

cin >> emp[2].hour_pay;

cout<<"Hours worked: ";

cout<<"Week 1: ";

cin >> emp[2].hours[0];

cout<<"Week 2: ";

cin >> emp[2].hours[1];

cout<<"Week 3: ";

cin >> emp[2].hours[2];

cout<<"Week 4: ";

cin >> emp[2].hours[3];

cout<<emp[3].first_name<<" "<<emp[3].last_name<<":\\";

cout<<"Pay per hour: ";

cin >> emp[3].hour_pay;

cout<<"Hours worked: ";

cout<<"Week 1: ";

cin >> emp[3].hours[0];

cout<<"Week 2: ";

cin >> emp[3].hours[1];

cout<<"Week 3: ";

cin >> emp[3].hours[2];

cout<<"Week 4: ";

cin >> emp[3].hours[3];

cout<<"Salaried Employees:\\";

cout<<emp[4].first_name<<" "<<emp[4].last_name<<":\\";

cout<<"Pay per annum: ";

cin >> emp[4].salary;

cout<<"Weeks worked: ";

cin >> emp[4].weeks;

cout<<emp[5].first_name<<" "<<emp[5].last_name<<":\\";

cout<<"Pay per annum: ";

cin >> emp[5].salary;

cout<<"Weeks worked: ";

cin >> emp[5].weeks;

emp[0].total_hours = emp[0].hours[0]+emp[0].hours[1]+emp[0].hours[2]+emp[0].hours[3];

emp[1].total_hours = emp[1].hours[0]+emp[1].hours[1]+emp[1].hours[2]+emp[1].hours[3];

emp[2].total_hours = emp[2].hours[0]+emp[2].hours[1]+emp[2].hours[2]+emp[2].hours[3];

emp[3].total_hours = emp[3].hours[0]+emp[3].hours[1]+emp[3].hours[2]+emp[3].hours[3];

cout<<"\\\\-----------------------------\\";

cout<<"Payroll for the month\\";

cout<<"Hourly Employees:\\";

cout<<"First Name Last Name\tHours Worked\tGross Pay\\";

cout<<emp[0].first_name<<" "<<emp[0].last_name<<"\t\t"<<emp[0].total_hours<<"\t"<<emp[0].hour_pay*emp[0].total_hours<<"\\";

cout<<emp[1].first_name<<" "<<emp[1].last_name<<"\t"<<emp[1].total_hours<<"\t"<<emp[1].hour_pay*emp[1].total_hours<<"\\";

cout<<emp[2].first_name<<" "<<emp[2].last_name<<"\t"<<emp[2].total_hours<<"\t"<<emp[2].hour_pay*emp[2].total_hours<<"\\";

cout<<emp[3].first_name<<" "<<emp[3].last_name<<"\t"<<emp[3].total_hours<<"\t"<<emp[3].hour_pay*emp[3].total_hours<<"\\";

cout<<"Salaried Employees:\\";

cout<<"First Name Last Name\tWeeks Worked\tGross Pay\\";

cout<<emp[4].first_name<<" "<<emp[4].last_name<<"\t"<<emp[4].weeks<<"\t"<<emp[4].weeks*emp[4].salary/48<<"\\";

cout<<emp[5].first_name<<" "<<emp[5].last_name<<"\t"<<emp[5].weeks<<"\t"<<emp[5].weeks*emp[5].salary/48<<"\\";

return 0;

}

User Csjpeter
by
4.0k points