Question

I need to see the program in C++: You are to write a payroll application for a company. You should prompt the user to input two values in the following order.You are to write a payroll application for a company. You should prompt the user to input two values in the following order. 1. The number of hours they worked. Our company only pays employees for full hours of work and do not count partial hours. Employees are not allowed to round up the time worked. So, 5 would be a valid input, but 5.7 would not be. 2. The hourly rate of the employee in USD (United States Dollars) to be inputted, for example, as: 12.30 Output the amount of money the company owes the employee.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

NOTE : if error: stray ‘\240’ occurs .Simply remove the spaces from each line. This error usually accour when you copy the to IDE

#include <iostream>
using namespace std;
int check(double hr)
{
int y;
y=hr*10;
if(y%10==0)
{
return 1;
}
else
{
cout<<"\n You are not allowed to round up number of hours worked \n";
return 0;
}
}

void payroll(double hr,double rate)
{
cout<<"Company owes you :"<<hr*rate<< "$";
}
int main()
{
double hr,rate;
while(1)
{
cout<<"\n Enter the numbers of hours worked :";
cin>>hr;

if(check(hr))
{
cout<<"\n Enter the hourly rate of the employee in USD :";
cin>>rate;
payroll(hr,rate);
break;
}
}
}

OUTPUT:

Enter the numbers of hours worked :5.1       

You are not allowed to round up number of hours worked   

Enter the numbers of hours worked :5                                                            Enter the hourly rate of the employee in USD :12.40

Company owes you :62$  

Add a comment
Know the answer?
Add Answer to:
I need to see the program in C++: You are to write a payroll application for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • J Inc. has a file with employee details. You are asked to write a C++ program...

    J Inc. has a file with employee details. You are asked to write a C++ program to read the file and display the results with appropriate formatting. Read from the file a person's name, SSN, and hourly wage, the number of hours worked in a week, and his or her status and store it in appropriate vector of obiects. For the output, you must display the person's name, SSN, wage, hours worked, straight time pay, overtime pay, employee status and...

  • Hello I am confused about this C++ program. I need to create a payroll C++ program...

    Hello I am confused about this C++ program. I need to create a payroll C++ program following these steps. Source file structure Your program will consist of three source files: main.cpp the main program Payroll.hppclass declaration for the Payroll class. Make sure you have an include guard. Payroll.cpp Payroll's member functions Class definition Create a Payroll class definition. The class has private members which originate from user input: number of hours worked hourly rate float float - and private members...

  • Write a C program that will calculate the gross pay of a set of employees. The...

    Write a C program that will calculate the gross pay of a set of employees. The program should prompt the user to enter the number of hours each employee worked. When prompted, key in the hours shown below. The program determines the overtime hours (anything over 40 hours), the gross pay and then outputs a table in the following format. Column alignment, leading zeros in Clock#, and zero suppression in float fields is important. Use 1.5 as the overtime pay...

  • You are to write a program that will process employees and their pay. For each employee...

    You are to write a program that will process employees and their pay. For each employee the program will read in an employee’s name and hourly pay rate. It should also read in the number of hours worked each day for 5 days and calculate his or her total number of hours worked. You must read the hours using a loop. The program should output the employee’s name, gross pay, total withholding amount and net pay. Withholding is made up...

  • In C++ Please please help.. Assignment 5 - Payroll Version 1.0 In this assignment you must create and use a struct to hold the general employee information for one employee. Ideally, you should use an...

    In C++ Please please help.. Assignment 5 - Payroll Version 1.0 In this assignment you must create and use a struct to hold the general employee information for one employee. Ideally, you should use an array of structs to hold the employee information for all employees. If you choose to declare a separate struct for each employee, I will not deduct any points. However, I strongly recommend that you use an array of structs. Be sure to read through Chapter...

  • Please include function in this program Write a C program that will calculate the gross pay...

    Please include function in this program Write a C program that will calculate the gross pay of a set of employees utilizing pointers instead of array references. You program should continue to use all the features from past homeworks (functions, structures, constants, strings). The program should prompt the user to enter the number of hours each employee worked. When prompted, key in the hours shown below. The program determines the overtime hours (anything over 40 hours), the gross pay and...

  • How would I do this problem? Write a C++ menu driven Payroll program. Must be user...

    How would I do this problem? Write a C++ menu driven Payroll program. Must be user friendly.   Menu 1. Check data file   2. Read Data file 3. Process payroll for one employee 4. Process payroll for all employees 5. Print out to a text or an HTML file 6. Exit You must use the following Payroll classes, structures, pointers, arrays, enum, vector, recursive, advance file I/O, STL, template, iterators and containers. The program to process an input file below to...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list : You are given a non-decreasing sequence of n positive integers a1,a2,…,an. Print the number of distinct values in the sequence. For example, if the sequence is 1,2,2,2,3,4,4,5,7,10, the answer is 6 since distinct values are 1,2,3,4,5,7,10. Input The first line contains a positive integer n (1≤n≤1000) — the length of the sequence. The second line contains n space-separated positive integers a1,a2,…,an (1≤ai≤1000)...

  • Write a C++ menu driven Payroll program. Must be user friendly.   Menu 1. Check data file  ...

    Write a C++ menu driven Payroll program. Must be user friendly.   Menu 1. Check data file   2. Read Data file 3. Process payroll for one employee 4. Process payroll for all employees 5. Print out to a text or an HTML file 6. Exit You must use the following Payroll classes, structures, pointers, arrays, enum, vector, recursive, advance file I/O, STL, iterators and containers. The program to process an input file below to calculate tax of 28% and output it...

  • Program is to be written In C++, The output should look like the screen shot. It...

    Program is to be written In C++, The output should look like the screen shot. It should allow the user to continue to ask the user to enter all employee ID's until done and then prompt the user to enter the hours and pay rate for each employee ID. Please help:( Can you please run the program to make sure the output is just like the screenshot please? It needs to have the output that is in the screenshot provided,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT