Program that get status from user and display salary.
This example program is taken form the book ' C++ IT Series' Chapter No.5 Exercise program no.2.
Serior Salesperson is paid Rs.400 a week,and Junior salesperson is paid Rs.275 a week.write a program that accept as input a salesperson's status in character variable.If status is 'j' or 'J' junior salesperson's salary should display. If status is 'S' or 's' than senior salespersons salary should display otherwise display erroe message.
using namespace std;
#include<iostream>
#include<conio.h>
int main()
{
char ch;
int salary;
cout<<"Enter your status:\n j for junior.\n s for senior."<<endl;
cin>>ch;
if (ch=='j' || ch=='J')
{
salary=275*4;
cout<<"Your Salary is "<<salary;
}
else if (ch=='s' || ch=='S')
{
salary=400*4;
cout<<"Your Salary is "<<salary;
}
else
cout<<"Invalid Status";
getch();
return 0;
}
Program Idea:
we can also make a program as:
Serior Salesperson is paid Rs.400 a week,and Junior salesperson is paid Rs.275 a week.write a program that accept as input a salesperson's status in character variable.If status is 'j' or 'J' junior salesperson's salary should display. If status is 'S' or 's' than senior salespersons salary should display otherwise display erroe message.
using namespace std;
#include<iostream>
#include<conio.h>
int main()
{
char ch;
int salary;
cout<<"Enter your status:\n j for junior.\n s for senior."<<endl;
cin>>ch;
if (ch=='j' || ch=='J')
{
salary=275*4;
cout<<"Your Salary is "<<salary;
}
else if (ch=='s' || ch=='S')
{
salary=400*4;
cout<<"Your Salary is "<<salary;
}
else
cout<<"Invalid Status";
Output / Result |
getch();
return 0;
}
Program Idea:
we can also make a program as:
- salary calculator
- tax calculator
- paycheck calculator
- income tax calculator
- payroll calculator
- etc...
Program that get status from user and display salary.
Reviewed by Alpha
on
3/08/2017 04:33:00 pm
Rating:
No comments: