Monday, July 2, 2012

Business Solutions for the Problems by Using C++ Language


Samuel & Sons maintain their Employee Records (Maximum 10) in the following manner. Write a menu based Program for the following.

Main Menu

1.       Add Employee Records
2.       Display all the employees
3.       Over time details
4.       Gross Wage and Bonus
5.       Exit
Enter your Choice:

For the above scenario, The proposed program as mentioned below.
---------------------------------------------------------------

#include <iostream>
using namespace std;

void addemployee()
{
    cout << "employee successfully added."<<endl;
}
void displayemployee()
{
    cout << "Employee Details -2012."<<endl;
}
void displayot()
{
    cout << "Calculate Over Time"<<endl;
}
void displaywb()
{
    cout << "Calculate Wages and Bonus."<<endl;
}
void Error_handle()
{
cout<<"Command Aborted or Refused."<<endl;
}

void menu()
{
int input;
  cout<<"1. Add Employee Records\n";
  cout<<"2. Display all the employees\n";
  cout<<"3. Over time details\n";
  cout<<"4. Gross Wage and Bonus\n";
  cout<<"5. Exit\n";
  cout<<"Selection: ";
  cin>> input;
  switch ( input ) {
  case 1:            // Note the colon, not a semicolon
    addemployee();
    break;
  case 2:            // Note the colon, not a semicolon
    displayemployee();
    break;
  case 3:            // Note the colon, not a semicolon
    displayot();
    break;
  case 4:            // Note the colon, not a semicolon
    displaywb();
    break;
case 5:            // Note the colon, not a semicolon
    Error_handle();
    break;
  default:            // Note the colon, not a semicolon
   Error_handle();
    break;
  }
}
int main()
{
  char x;
   do {
    // message is printed at least one time
    //  even though the condition is false
 menu();
 cout<<"Do you want to continoue : Yes or No...?"<<endl;
cin>>x;
  } while ( x != 'n' );
  cin.get();
}


No comments:

Post a Comment