Question: im having trouble with using a switch statements..... to pass the program implements case statements and implements switch statements and Correctly outputs employee 's information
im having trouble with using a switch statements..... to pass the program implements case statements and implements switch statements and Correctly outputs employee's information which is
Enter Employee's First name: Jeanne Enter Employee's Last Name: Hanson Enter Employee's Yearly Salary: 70000.00 Enter Employee's Performance Rating: 2 Employee's NameJeanne Hanson Employee's Salary: $70000 Employee's Rating: 2 Employee's Bonus: 10500
- this is the prewritten statements Design the logic, and do the rest of the program using aswitchstatement.
#include
#include
usingnamespacestd;
intmain()
{
stringemployeeFirstName;//decralationsneeded
stringemployeeLastName;
doubleemployeeSalary;
intemployeeRating;
doubleemployeeBonus;
constdoubleBonus_1=.25;
constdoubleBonus_2=.15;
constdoubleBonus_3=.10;
constdoubleNo_Bonus=0.00;
constintRating_1=1;
constintRating_2=2;
constintRating_3=3;
cout<<"EnterEmployee'sFirstname:";//promptforfirstnameoftheuser
cin>>employeeFirstName;
cout<<"EnterEmployee'sLastName:";
cin>>employeeLastName;
cout<<"EnterEmployee'sYearlySalary:";
cin>>employeeSalary;
cout<<"EnterEmployee'sPerformanceRating:";
cin>>employeeRating;
switch(employeeRating)//implementationofthecasestatements
{
case1:
employeeBonus=employeeSalary*Bonus_1;
break;
case2:
employeeBonus=employeeSalary*Bonus_2;
break;
case3:
employeeBonus=employeeSalary*Bonus_3;
break;
default:
employeeBonus=0;
}
cout<<"Employee'sName"< cout<<"Employee'sSalary:$"< cout<<"Employee'sRating:"< cout<<"Employee'sBonus:"< return0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
