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). Please provide the txt file and format if you use one. Thank you!

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students explore these related Databases questions