Hello how is everyone doing! I just want to make sure that this code was working properly. I tried compling this code on Visual Basic C++ 6.0 and it worked out fine without any errors or warnings. I am not looking for a quick answer. I just want to receive any help with my program below asap. Oh, and I know this is a hmwk problem but I believe this code needs some improvement.

#include <math.h>
#include <iostream.h>


using std::cout;
using std::cin;


int main()
{
gross pay, hourly rate, hrs;
cout << "\n Proceed access towards inputing hours in a weekly basis: "
cin >> hours;
if(hrs >= 40)
cout << "time_and_a_half"
else
cout << "straight time"
switch(number)  //calculate the gross pay
{
case 1:
cout << "caluclate the weekly salary"
gross pay = weeks * hourly rate
break;
default:
cout << "\n Please try again!   \n";
}
return 0;
}

Objective:

Develop a C++ program that will determine the gross pay for each of several employees. The company pays “straight-time for the first 40 hours worked by each employee and pays “time-and-a-half for all hours worked in excess of 40 hours. You are given the number of hours each employee worked last week and the hourly rate of each employee. Your program should input this information for each employee and should determine and display the employee's gross pay. You should perform the calculation for three employees.

Recommended Answers

All 2 Replies

Also I just found out that this program came with 22 errors and no warnings :-(.

put the missing semicolons.
define undefined variables.
there is whitespace between

hourly rate

and

gross pay

. Remove them.
I dont know how you got this to compile in Visual C++ 6.0

correct the mistakes I pointed out and post the code again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.