Answer to Question #174146 in C++ for Raj Kumar

Question #174146

In a company an employee is paid as under: If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and DA = 90% of basic salary. If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary. If the employee's salary is input by the user write a program to find his gross salary.


1
Expert's answer
2021-03-22T00:40:53-0400


using namespace std;
main(void)
{
	float GrossSalary,Basic,DA,HRA;
	int Flag =-1;
	
	while(Flag)
	{
		Flag=-1;
		while(Flag<0 || Flag>1) 
		{
			cout<<"\n\n\nPress 1 to enter Basic Salary: ";
			cout<<"\nPress 0 to QUIT.";
			cout<<"\nEnter Option (1/0): "; cin>>Flag;
		}
		if(Flag)
		{
			cout<<"\n\nEnter Basic Salary: "; cin>>Basic;
			if(Basic <1500)
			{
				HRA = (10*Basic)/100;
				DA =  (90*Basic)/100;
				GrossSalary = Basic + HRA + DA;
			}
			if(Basic >= 1500)
			{
				HRA = 500;
				DA =  (98*Basic)/100;
				GrossSalary = Basic + HRA + DA;
			}
			cout<<"\n\nBasic        = "<<Basic;
			cout<<"\nHRA          = "<<HRA;
			cout<<"\nDA           = "<<DA;
			cout<<"\nGross Salary = "<<GrossSalary;
		}
	}
	
}




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