Epic Systems Interview Question
System Administrators#include<iostream>
#include<stdlib.h>
#include<sstream>
#include<string.h>
using namespace std;
void main()
{
char Cate;
float total_sallary,basic,incre;
cout<<"select the catagory A,B or C"<<endl;
cin>>Cate;
//cout<<"Cate"<<Cate;
cout<<"Enter the basic sallary for the employ"<<endl;
cin>>basic;
//cout<<"Basic:"<<basic;
cout<<"Select the increment:"<<endl;
cin>>incre;
//cout<<"incre"<<incre;
switch(Cate)
{
case 'A':
{
total_sallary = (basic+(basic*(3*incre/100)));
if(total_sallary>=50000)
cout<<"Sallary grater than 50K"<<endl;
else
cout<<"Total Sallary is:"<<total_sallary<<endl;
}break;
case 'a':
{
total_sallary=(basic+(basic*((3*incre)/100)));
if(total_sallary>=50000)
cout<<"Sallary grater than 50K"<<endl;
else
cout<<"Total Sallary is:"<<total_sallary<<endl;
}break;
case 'B':
{
total_sallary=basic+(basic*((2*incre)/100));
if(total_sallary>=50000)
cout<<"Sallary grater than 50K"<<endl;
else
cout<<"Total Sallary is:"<<total_sallary<<endl;
}break;
case 'b':
{
total_sallary=basic+(basic*((2*incre)/100));
if(total_sallary>=50000)
cout<<"Sallary grater than 50K"<<endl;
else
cout<<"Total Sallary is:"<<total_sallary<<endl;
}break;
case 'C':
{
total_sallary=basic+(basic*(incre/100));
if(total_sallary>=50000)
cout<<"Sallary grater than 50K"<<endl;
else
cout<<"Total Sallary is:"<<total_sallary<<endl;
}break;
case 'c':
{
total_sallary=basic+(basic*(incre/100));
if(total_sallary>=50000)
cout<<"Sallary grater than 50K"<<endl;
else
cout<<"Total Sallary is:"<<total_sallary<<endl;
}
}
system("PAUSE");
}
you forgot to check whether the increment is greater than 1. Just one more if condition and it will work fine :)
What do you exactly mean?
- chenming831@hotmail.com May 16, 2010