At Westonci.ca, we make it easy to get the answers you need from a community of informed and experienced contributors. Get accurate and detailed answers to your questions from a dedicated community of experts on our Q&A platform. Get immediate and reliable solutions to your questions from a community of experienced professionals 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
We appreciate your visit. Hopefully, the answers you found were beneficial. Don't hesitate to come back for more information. We appreciate your time. Please revisit us for more reliable answers to any questions you may have. Get the answers you need at Westonci.ca. Stay informed with our latest expert advice.