How do I do this and zip the file Create a program that disp


How do I do this and zip the file?

Create a program that displays the weekly gross pay for any number of employees. The user will input the number of hours the employee worked and the employee\'s hourly rate. Employees working more than 40 hours receive time and one-half for the hours worked over 40. If necessary, create a new project named Introductory18 Project, and save it in the Cpp81Chap07 folder. Enter the C++ instructions into a source file named Introductory18.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Save, run, and test the program.

Solution

Below Code block implements a C++ program which takes N number of employees details and calculates their gross weekly salary based on the inputs like total number week hours and the rate per hour. The code is implemented using Class. Comments are provided in the code.

I will not be able to zip the file, so whole code is provided. Please copy and create the cpp file and execute

********************************************************

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#define SIZE 100

class Employee // Employee Class
{
int totalWeekHrs;
float ratePerHr;
float totalWeekSal;
char name[20],num[10];
public:
void getdata(); // function to get data from user
void calculateTotalSal(); // function to calculate gross weekly salary
void dispdata(); // function to display data
};

void Employee::getdata()
    {
      cout<<\"\             Enter employee number: \";
      gets(num);
      cout<<\"            Enter employee name: \";
      gets(name);
      cout<<\"Enter employee total working hours in current week: \";
      cin>>totalWeekHrs;
      cout<<\"Enter employee rate per hour: \";
      cin>>ratePerHr;

    }

void Employee::calculateTotalSal()
    {
      int x;
      float extraSal;
      if(totalWeekHrs<=40)
       {

totalWeekSal=totalWeekHrs*ratePerHr;
       }
      else
       {
totalWeekSal=40*ratePerHr;
x= totalWeekHrs-40;
extraSal= x*(ratePerHr/2);
totalWeekSal+=extraSal;
       }
    }

void Employee::dispdata()
    {
      cout
     <<\"\       Employee number: \"<<num
     <<\"\       Employee name: \"<<name
     <<\"\       total working hours in current week: \"<<totalWeekHrs
     <<\"\       rate per Hour: \"<<ratePerHr<<\" $\"
     <<\"\       Gross Weekly Salary: \"<<totalWeekSal<<\" $\";

    }

void main()
{
     clrscr();
     Employee ob[SIZE]; // array of Employees
     int n;
     cout<<\"\ \ ********************************************\"
<<\"\ Calculation of Employee Gross Weekly Salary\"
<<\"\ **********************************************\"
<<\"\ Enter the number of employees: \";
     cin>>n;
     for(int i=0;i<n;i++)
{
     ob[i].getdata();
     ob[i].calculateTotalSal();
}
     clrscr();
     cout<<\"\ -----------------\"
<<\"\ Employee Detail::\"
<<\"\ -----------------\";
     for( i=0;i<n;i++)
   {
     cout<<\"\ \ Employee:\"<<i+1
  <<\"\ ----------\";
     ob[i].dispdata();
   }
     getch();
}

 How do I do this and zip the file? Create a program that displays the weekly gross pay for any number of employees. The user will input the number of hours the
 How do I do this and zip the file? Create a program that displays the weekly gross pay for any number of employees. The user will input the number of hours the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site