Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this C++ assignment, I have completed Part 1, I will post below the instructions and modifications needed to be added to

I need help with this C++ assignment, I have completed Part 1, I will post below the instructions and modifications needed to be added to my existing code. My existing code will be below the instructions for my current assignment (part 2).

Espresso Yourselfs Coffeehouse Payroll Program Part 2

This is a continuation of last weeks program. Which means you better update last weeks program to be correct and work. And remember it is NOT ok for you to use the Module 2 solution as your starting point for this assignment!

This weeks requirements:

  1. All of the input data must be in a file
    1. The employees name
    2. Followed by their hours
  2. All of the output data displayed will be formatted
    1. Names 10 blank spaces in between
      1. Left justified
      2. 20 spaces to hold the name
    2. Monthly pay
      1. Right justified
      2. Always show the decimal place and 2 digits after it for the cents
      3. 9 spaces to hold the monthly pay
      4. Include the $ before the 9 spaces, not part of it
      5. Fill the empty space between the number and the $ with * (the asterisk)
  3. Add the owners salary
    1. Liza Bossert
    2. Salaried - $75,000.00 / year
    3. For the owner you will show her monthly salary first and separately
    4. Titled Owners Salary
    5. Followed by 5 blank spaces
    6. 10 formatted spaces for the pay
    7. Rest of the formatting, use the same as the rest of the employees

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

Existing code from part 1:

#include "stdafx.h" #include #include #include

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; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

What are the functions of top management?

Answered: 1 week ago

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago