Thursday 17 July 2014

Write a Program in C++ Which Compute the Workers Salary

1. Number of Working Hours
2. Hourly Wage
3.Total Salary of the Worker

Structure of the Problem Requirements

In this Problem we Need to compute the Monthly Salary of the Worker . We just Need a Mathematical Relation to find out the Salary . First We Should Know the Total Number of Hours and then the Hourly Wage . After Multiplying both we get the total Salary of a Worker of a Month.

Source Code 

#include <iostream>
using namespace std;
int main()
{
int numOfDaysWorked,numOfHrsPerDay; //Declare the Variable which is used in Programme
float hourlyWage,totalSalary,perDaySalary; //Declare the Variable which is used in Programme
char answer; //Declare the Variable which is used in Programme
cout<<endl<<endl<<"****************** COMPUTE SALARY ******************"<<endl<<endl;
do
{
cout<<endl<<"Enter Number of Days Worked: ";
cin>>numOfDaysWorked; //Input the Number of days of Working
cout<<endl<<"Enter Number of Hours Per Day: ";
cin>>numOfHrsPerDay; //Input the Paid of one day
cout<<endl<<"Enter Hourly Wage: ";
cin>>hourlyWage; // Input the hourly paid
perDaySalary=hourlyWage*numOfHrsPerDay;
totalSalary=perDaySalary*numOfDaysWorked;
cout<<endl<<"Total Salary = "<<totalSalary<<" Rupees"<<endl;
cout<<endl<<"Do you want to continue (y/n)? : "; // Do you want to More 
cin>>answer;
}while(tolower(answer)=='y');
return 0;
}

Output of the Program


Enter Days and hour and Display Pay
Compute the Worker Salary






Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

1 comments: Post Yours! Read Comment Policy!▼
Important Note:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

  1. good piece of coding you have for learning

    ReplyDelete