1. Number of Working Hours
2. Hourly Wage
3.Total Salary of the Worker
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
Compute the Worker Salary |