Dec 20, 2014 at 11:45am UTC
I have a question i need help
1\write a c++ program to count no of letters in a given line
2\write a c++ program to calculate employee salary
validation : for the salary less than 5000
a. HRA IS 15% OF BASIC salary
b. DA is 35% of basic salary
for salary above 5000
a HRA is 5% of basic salary
b. DA is 25% of basic salary
Dec 20, 2014 at 12:04pm UTC
You should also show your code...
Dec 20, 2014 at 12:27pm UTC
first one i thank he want example
and the second with c++
Dec 20, 2014 at 12:29pm UTC
I was talking about what you tried to write... This is homework, so the first attempt should come from you! ;)
Dec 20, 2014 at 12:34pm UTC
will I'm not sure of my answer
so i want to see another answer
Dec 20, 2014 at 12:36pm UTC
Nobody here is going to give you a grade! So please show what you did, otherwise what do we have to think? That you want your homework done? :)
Dec 20, 2014 at 1:20pm UTC
second one what the mistake
#include<iostream>
using namespace std;
int main()
{
float basic_salary, gross_salary, HRA, DA;
cout<<"Enter basic salary of Employee : ";
cin>>basic_salary;
if (basic_salary<5000)
{
HRA=0.15*basic_salary;
DA=0.35*basic_salary;
}
else
{
HRA=0.5*basic_salary;
DA=0.25*basic_salary;
}
gross_salary=basic_salary+HRA+DA;
cout<<"Gross salary is : "<<gross_salary;
cin.ignore();
cin.get();
return 0;
}
Dec 20, 2014 at 5:16pm UTC
5% is not .5
for salary above 5000
a HRA is 5% of basic salary
b. DA is 25% of basic salary
1 2 3 4 5
else
{
HRA=0.5 *basic_salary;
DA=0.25*basic_salary;
}
Edit: I'm not sure what HRA and DA are, so I'm assuming it's correct they should be added to the basic salary?
Last edited on Dec 20, 2014 at 5:19pm UTC