please help me

i want to Update the program to add a menu for choosing the operation (Search Data, Add a Record, Update Data, Quit)


.......
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
struct Salary
{
float basic_salary;
float deductions;
float bonuses;
float tax;
float net_salary;
};
struct Employee
{
string Name;
int ID;
Salary Sal1;
};

int main()
{
int i;
Employee Emp[3];
for( i=0; i<3; i++)
{
cout<<"Enter the Name of Employee "<<i+1<<": \n";
cin>> Emp[i].Name;
Emp[i].ID=i+1;
cout<<"Enter the basic_salary of Employee "<<i+1<<": \n";
cin>>Emp[i].Sal1.basic_salary;
cout<<"Enter the deductions of Employee "<<i+1<<": \n";
cin>> Emp[i].Sal1.deductions;
cout<<"Enter the bonuses of Employee "<<i+1<<": \n";
cin>> Emp[i].Sal1.bonuses;
if( Emp[i].Sal1.basic_salary<=499)
Emp[i].Sal1.tax=0.0;
else if( Emp[i].Sal1.basic_salary>=500 && Emp[i].Sal1.basic_salary<=800 )
Emp[i].Sal1.tax=0.07*Emp[i].Sal1.basic_salary;
else if( Emp[i].Sal1.basic_salary>=801 && Emp[i].Sal1.basic_salary<=1200)
Emp[i].Sal1.tax=0.10*Emp[i].Sal1.basic_salary;
else
Emp[i].Sal1.tax=0.15*Emp[i].Sal1.basic_salary;
Emp[i].Sal1.net_salary = Emp[i].Sal1.basic_salary + Emp[i].Sal1.bonuses - Emp[i].Sal1.deductions - Emp[i].Sal1.tax;
}

cout<<"Salaries Report"<<endl;

cout<<" ID "<<setw(25)<<" Name "<<setw(25)<<" Basic Salary "<<setw(25)<< " Bonuses " << setw(25)<<" Deductions " <<setw(25) <<" Tax " <<setw(25)<<" Net Salary "<<endl;
cout<< "========================================================================================================================"<<endl;

for( i=0; i<3;i++)
{
cout<<Emp[i].ID<<" "<<setw(25)<<Emp[i].Name<<setw(25)<<Emp[i].Sal1.basic_salary<<setw(25)<< Emp[i].Sal1.bonuses<< setw(25)<<Emp[i].Sal1.deductions <<setw(25) <<Emp[i].Sal1.tax <<setw(25)<<Emp[i].Sal1.net_salary<<endl;
}

cout<<" =========================================================="<<endl;
cout<<" =========================================================="<<endl;
bool found = false;
int Emp_searchid;
cout<<"Enter the Employee ID for searching "<<endl;
cin>> Emp_searchid;
for( i=0; i<3;i++)
if (Emp[i].ID==Emp_searchid)
{found =true; break;}
if (found)
cout<<Emp[i].ID<<" "<<setw(25)<<Emp[i].Name<<setw(25)<<Emp[i].Sal1.basic_salary<<setw(25)<< Emp[i].Sal1.bonuses<< setw(25)<<Emp[i].Sal1.deductions <<setw(25) <<Emp[i].Sal1.tax <<setw(25)<<Emp[i].Sal1.net_salary<<endl;
else
cout<<" The Employee is not found " ;

return 0;
}
Last edited on
Hello there!
Hope you’re doing good
I can help with your requirement.
Kindly reach out to me at [email protected] or skype me at cisin.angela.
Hope to hear from you soon.
Have a nice day.
Thanks and Regards,
Angela
Topic archived. No new replies allowed.