Answer to Question #298694 in C++ for Wasim Akram

Question #298694

Write a program to calculate the net salary of an employee using the concept of structure.


1
Expert's answer
2022-02-17T02:16:04-0500
#include<iostream>

using namespace std;

struct Salary
{
	float basic, da,hra,ta,others;
	float pf,it;
	float net_salary;
};

int main()
{
	Salary s; 
	cout<<"Please, enter Basic Salary($): ";
	cin>>s.basic;
	cout<<"Please, enter HRA($): ";
	cin>>s.hra;
	cout<<"Please, enter TA($): ";
	cin>>s.ta;
	cout<<"Please, enter others($): ";
	cin>>s.others;
	//calculate DA 12% of Basic Salary
	s.da=s.basic*0.12;
	//calculate pf 14% of Basic Salary
	s.pf=s.basic*0.14;
	//calculate pf 15% of Basic Salary
	s.it=s.basic*0.15;
	s.net_salary=s.basic+s.da+s.hra+s.ta+s.others-(s.pf+s.it);
	cout<<"Net salary is "<<s.net_salary;3
	
}

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