Answer to Question #272942 in C++ for rrrfyhc cu

Question #272942

You are an employee of a marketing organization that pays you a monthly salary of Ksh. 10,000 if you work for the recommended 160 hours a month (Monday - Friday, 9am - 5pm, for a month). This salary can however fluctuate based on the number of hours worked, in that if you work for more than the recommended working hours ie above 160 hours, you earn an extra 10% of your salary but if you work for less than 160 hours, you will be deducted 10% of your salary. With the aid of a SWITCH CASE select structure Implement a program written in C++ that would help the finance department calculate your monthly salary based on the hours worked being the input value of the program.


1
Expert's answer
2021-11-29T06:54:13-0500
#include<iostream>

using namespace std;

int main()
{
	enum variant{ONE=1,TWO,THREE};
	variant v;
	double workHours;
	const int monSal=10000;
	
	do
	{
		cout<<"\nPlease, enter the hours worked by the worker, 0 - exit : ";
		cin>>workHours;
		if(workHours==0)break;
		if(workHours>160)v=TWO;
		else if(workHours<160)v=THREE;
		else v=ONE;
		switch (v)
		{
			case ONE:
			{
				cout<<"Worker`s monthly salary is "
					<<monSal<<" Ksh.";
				break;
			}
			case TWO:
			{
				cout<<"Worker`s monthly salary is "
					<<monSal+0.1*monSal<<" Ksh.";
				break;
			}
			case THREE:
			{
				cout<<"Worker`s monthly salary is "
					<<monSal-0.1*monSal<<" Ksh.";
				break;
			}
		}	
	}while(true);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS