Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the program in C++ Only Here's The Project 4 Program #include #include #include #include using namespace std; //Prototype functions double calcWage(); void getEmployeeInfor(); void

Write the program in C++ Only

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Here's The Project 4 Program

#include #include #include #include

using namespace std;

//Prototype functions double calcWage(); void getEmployeeInfor(); void printWages(); void printTable(); void loop();

//Defining terms for the program. int id,result; double payRate, hours, wage; ofstream outputFile; //ifstream inputFile; string file,strings;

int main() { //Initally get the filename to save the final output to this file cout > file; outputFile.open(file.c_str()); //open the file

//Get employee information getEmployeeInfor(); //Calculate the total wage wage = calcWage(); //Prints the Table to the outputFile printTable(); //Prints the wages to the output File printWages(); //Ask if more informations wants to be added/ calculated loop(); return 0; }

//Function for asking user for Employee Id, pay rate, and the hours worked void getEmployeeInfor()

{ cout > id >> payRate >> hours;

//Loop to check for valid numbers. while ((id > id >> payRate >> hours; } }

//Function for calculating the Wage double calcWage() { double wages; return wages = payRate * hours; }

//Function for printing information to the outputFile void printWages() { outputFile

//Function to print table to the outputFile void printTable()

{ outputFile

//Function that asks the user if the process wants to be repeated void loop() { char answer; cout > answer; if (answer == 'y'|| answer == 'Y') { getEmployeeInfor(); // gets employee information wage = calcWage(); // calculates wage printWages(); // prints wage to the outputfile //calls loop function again to get an Y or N; loop(); } else { //Close the outputfile and display final message outputFile.close(); cout

Objectives To provide students with the experience of using classes and functions to solve a problem Problems Modify Project 4 (Payroll System) so that an employee's data can be added, deleted, modified, and displayed. You are asked to use a menu to provide these services for the users. The menu might look like this: Menu 1. Add new employees to the database. 2. Modify employee data in the database. 3. Delete employees from the database. 4. Display employee data to the screen. 5. Quit the system Requirements 1. Design two classes to solve this problem. One class, called Employee, stores employee's data; the other class, called EmployeeList, holds a list of employee objects (called a container) 2. The class Employee should have the data members of id, first name, last name, rate, and hours. The following member functions should be provided - a constructor to initialize employee's data with id, first name, last name, rate and hours. Use default arguments A member function that sets the last name A member function that sets the first name A member function that sets the id A member function that sets the rate A member function that sets the hours - - A member function that retrieves the last name A member function that retrieves the first name A member function that retrieves the id . A member function that retrieves the rate " A member function that computes and returns the wage The class should also have the following overloaded operators: A member function that retrieves the hours Objectives To provide students with the experience of using classes and functions to solve a problem Problems Modify Project 4 (Payroll System) so that an employee's data can be added, deleted, modified, and displayed. You are asked to use a menu to provide these services for the users. The menu might look like this: Menu 1. Add new employees to the database. 2. Modify employee data in the database. 3. Delete employees from the database. 4. Display employee data to the screen. 5. Quit the system Requirements 1. Design two classes to solve this problem. One class, called Employee, stores employee's data; the other class, called EmployeeList, holds a list of employee objects (called a container) 2. The class Employee should have the data members of id, first name, last name, rate, and hours. The following member functions should be provided - a constructor to initialize employee's data with id, first name, last name, rate and hours. Use default arguments A member function that sets the last name A member function that sets the first name A member function that sets the id A member function that sets the rate A member function that sets the hours - - A member function that retrieves the last name A member function that retrieves the first name A member function that retrieves the id . A member function that retrieves the rate " A member function that computes and returns the wage The class should also have the following overloaded operators: A member function that retrieves the hours

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

Step: 3

blur-text-image

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

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions