Question

In: Computer Science

write a program to calculate and print payslips write program that calculates and prints payslips. User...

write a program to calculate and print payslips

write program that calculates and prints payslips. User inputs are the name of employee, numbers of hours worked and hourly rate

c++ language

Solutions

Expert Solution

#include <iostream>
using namespace std;

int main() {
  
   string empName;
   int hours;
   double payRate;
  
  
   cout<<"Enter the name of employee : ";
   cin>>empName;
  
   cout<<"\nEnter the number of hours worked : ";
   cin>>hours;
  
   cout<<"\nEnter hourly rate : ";
   cin>>payRate;
  
   double wages = hours*payRate;
  
   cout<<endl<<endl;
   cout<<"--------- PAYSLIP-----------"<<endl;
   cout<<"Employee Name : "<<empName<<endl;
   cout<<"Hours Worked : "<<hours<<endl;
   cout<<"Hourly Pay Rate : "<<payRate<<endl;
   cout<<"Wages : $"<<wages<<endl;
   cout<<"-----------------------------"<<endl;
  
  
   return 0;
}

Output:

Enter the name of employee : John
Enter the number of hours worked : 38
Enter hourly rate : 12.56

--------- PAYSLIP-----------
Employee Name : John
Hours Worked : 38
Hourly Pay Rate : 12.56
Wages : $477.28
-----------------------------

Do ask if any doubt. Please upvote.


Related Solutions

User asks you to develop a program that calculates and then prints interest earned on a...
User asks you to develop a program that calculates and then prints interest earned on a bank balance. Program should print interest earned for the same balance when interest is accumulated annually, semiannually and quarterly. I need the C++ code!
Write a program that asks the user for an integer. The program checks and prints to...
Write a program that asks the user for an integer. The program checks and prints to the screen whether the number is prime or not. For example, if user enters 17, the program should print “17 is prime”; if the user enters 20, the program should print “20 is not prime”. please do it with a “ while Loop”, Thanks..
Write a program that calculates and prints the bill for a cellular telephone company. The company...
Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of services: regular and premium. Its rates vary depending on the type of service. The rates are computed as follows: Regular service: $10.00 plus the first 50 minutes are free. Charges for over 50 minutes are $0.20 per minute. Premium Service:        $25.00 plus For calls made from 6:00 A.M. to 6:00 P.M., the first 75 minutes are free; charges for over...
Write a program that calculates and prints the bill for a cellular telephone company. The company...
Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of services: regular and premium. Its rates vary depending on the type of service. The rates are computed as follows: Regular service: $10.00 plus the first 50 minutes are free. Charges for over 50 minutes are $0.20 per minute. Premium Service:        $25.00 plus in C++ (Basic) For calls made from 6:00 A.M. to 6:00 P.M., the first 75 minutes are free;...
Write a program that calculates the salary of employees. The program should prompt the user to...
Write a program that calculates the salary of employees. The program should prompt the user to enter hourly rate and number of hours of work a day. Then, the program should display the salary daily, bi-weekly (5 days a week), and monthly. Sample program: Enter your hourly rate: >>> 20 Enter how many hours you work a day: >>> 8 Your daily salary is: $160 Your bi-weekly salary is: $1600 Your monthly: $3200
In Python write a program that calculates and prints out bills of the city water company....
In Python write a program that calculates and prints out bills of the city water company. The water rates vary, depending on whether the bill is for home use, commercial use, or industrial use. A code of r means residential use, a code of c means commercial use, and a code of i means industrial use. Any other code should be treated as an error. The water rates are computed as follows:Three types of customers and their billing rates: Code...
Write a pyhton program that reads a stream of bits, e.g. 11001, and calculates and prints...
Write a pyhton program that reads a stream of bits, e.g. 11001, and calculates and prints the decimal value of the binary number represented by the entered bits, i.e. 25 in this case.
Write a short program that asks the user for a sentence and prints the result of...
Write a short program that asks the user for a sentence and prints the result of removing all of the spaces. Do NOT use a built-in method to remove the spaces. You should programmatically loop through the sentence (one letter at a time) to remove the spaces.
Need to write a c program Program prints a message telling the user to push a...
Need to write a c program Program prints a message telling the user to push a key to start the game. Once in game, output tells the player which key to push. The key to press should be determined randomly. Game runs continuously until the user reaches a loose condition. A wrong key is pressed
Write a program that prompts a user for an integer from 1 to 99 and prints...
Write a program that prompts a user for an integer from 1 to 99 and prints it as an amount in words. The program will loop in case the user wants to input an additional number. If the user enters -99, the program will exit. Example: Input: 89 Output: Eighty nine Input: 45 Output: Fourty five Input: -99 Output: Have a nice day. <program exits> For this project, you are to: 1) You should validate any data coming from the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT