Westonci.ca is your trusted source for finding answers to all your questions. Ask, explore, and learn with our expert community. Experience the convenience of finding accurate answers to your questions from knowledgeable professionals on our platform. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.

Write a c++ program to input basic salary of an employee and calculate its Gross salary according to following

Basic Salary <25000 : HRA =20%,DA=80%
Basic salary >= 25000: HRA=25%,DA=90%
Basic Salary >= 40000:HRA=30%,DA=95%​


Sagot :

[tex]\large\bold{\underline{\underline{Program :}}}[/tex]

#include<iostream>

using namespace std;

int main ()

{

float basic, gross, da, hra;

cout<<"Enter basic salary of an employee:";

cin>>basic;

if (basic <25000)

{

da = basic *80/100;

hra = basic *20/100;

}

else if (basic >=25000 & & basic<40000)

{

da = basic *90/100;

hra = basic *25/100;

}

else if (basic>=40000)

{

da = basic *95/100;

hra = basic *30/100;

}

gross = basic + hra + da;

cout<<"\n\t Basic Pay............" <<basic<<endl;

cout<<"\t Dearness Allowance..........." <<da<<endl;

cout<<"\t House Rent Allowance......" <<hra<<endl;

cout<<"\t Gross Salary............." <<gross<<endl;

cout<<"\t - - - - - - - - - - - - - - -" <<endl;

[tex]\large\bold{\underline{\underline{Output :}}}[/tex]

Enter Basic Salary of an employee : 25000

Basic Pay : 25000

Dearness Allowance : 22500

House Rent Allowance : 6250

Gross Salary : 53750

[tex]\large\bold{\underline{\underline{Result :}}}[/tex]

The Expected Output is archived

Using the knowledge of code in c++ we have to be the same as the attached image.

In a simpler way, we have that this code can be described as:

#include<iostream>

using namespace std;

int main ()

{

float basic, gross, da, hra;

cout<<"Enter basic salary of an employee:";

cin>>basic;

if (basic <25000)

{

da = basic *80/100;

hra = basic *20/100;

}

else if (basic >=25000 & & basic<40000)

{

da = basic *90/100;

hra = basic *25/100;

}

else if (basic>=40000)

{

da = basic *95/100;

hra = basic *30/100;

}

gross = basic + hra + da;

cout<<"\n\t Basic Pay............" <<basic<<endl;

cout<<"\t Dearness Allowance..........." <<da<<endl;

cout<<"\t House Rent Allowance......" <<hra<<endl;

cout<<"\t Gross Salary............." <<gross<<endl;

cout<<"\t - - - - - - - - - - - - - - -" <<endl;

See more about C++ code at brainly.com/question/25870717

View image lhmarianateixeira
Thanks for using our service. We aim to provide the most accurate answers for all your queries. Visit us again for more insights. Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. Thank you for visiting Westonci.ca, your go-to source for reliable answers. Come back soon for more expert insights.