is this program accurate? if not i need somebody dat can make clear directions to me on how to create this program with no errors or warnings. i got 2 errors n 1 warning on here so far after i compiled it.

the code is in the following:
//Program 2-2 Calculating the income for employees.
#include <iostream.h>

int main()
{
int wage, hours;

cout << "\n Enter the time in hours";
cin >> time;

int count = 0; //
while ( hours >=40) {
wage = (40 * hourly rate)
cin >> gross pay;
}
;return 0;
}
The objective is in the following:

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 5 Replies

is this program accurate? if not i need somebody dat can make clear directions to me on how to create this program with no errors or warnings. i got 2 errors n 1 warning on here so far after i compiled it. :cool:

the code is displayed in the following:

//Program 2-2 Calculating the income for the employees.


#include <iostream.h>


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


#include <iomanip.h>


using std::setiosflags;
using std::setprecision;


int main()
{
int wage, hours;


cout << "Enter the time in hours (0 to end): "
<< setiosflags( ios::fixed | ios::showpoint);
cin >> time;


int count = 0;
while ( hours >=40) {
wage = (40 * hourly rate)
cout << "gross pay result" << endl << setprecision(40) << hours
<< "\n\nEnter wage in dollars (0 to end): ";
cin >> gross pay;
}


return 0;
}

also I must follow this 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

Read this and edit your posts to include code tags
http://www.daniweb.com/techtalkforums/announcement8-3.html

> i got 2 errors n 1 warning on here so far after i compiled it
So post those as well. It's even better if you comment the code you post indicating which lines are causing you problems.

is this program accurate? if not i need somebody dat can make clear directions to me on how to create this program with no errors or warnings. i got 2 errors n 1 warning on here so far after i compiled it. :cool:

the code is displayed in the following:

//Program 2-2 Calculating the income for the employees.

#include <iostream.h>

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

#include <iomanip.h>

using std::setiosflags;
using std::setprecision;

int main()
{
   int wage, hours;		
   
   cout << "Enter the time in hours (0 to end): "  
         << setiosflags( ios::fixed | ios::showpoint);
   cin >> time;

   int count = 0;	
   while ( hours >=40) {  
	  wage = (40 * hourly rate)
      cout << "gross pay result" << endl << setprecision(40) << hours
            << "\n\nEnter wage in dollars (0 to end): ";
      cin >> gross pay;
   }

   return 0;
}

also I must follow this 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

i am trying to find the lines that are still giving me problems. plus, i am a novice at c++ programming and i don't know which lines to point out. i used visual basic c++ 6.0 to compile the code n it n some of the info bout the errors came out unclear to me.

It would help if you could paste the exact error(s) - Be aware VC++ 6.0 is out of date, I strongly recommend downloading a newer compiler before you do anything else. There is definitely more than just one error in that code!


It looks to me like you are trying to do too much without understanding what you're doing. Start out simple - try making a small program that just takes user input and displays it on the screen. before you go on, you need to declare and initialise variables properly. You also need to use identifiers without spaces. Once you've got that compiled properly and working, expand the program... Walk before you run ;)

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.