Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » Homework HelpRSS Feeds

Program that maintains employee database of an education system

Posted By: Easy Tutor     Category: Java     Views: 13353

An educational institution wishes to maintain a database of its employees. The database is divided
into a number of classes. Specify all the classes and define methods to create the database and retrieve
individual information as and when required.

Code for Program that maintains employee database of an education system in Java

import java.io.*;

class staff
{
         String code,name;
         void getStaff()
         {   
              try{
                  BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
                  System.out.print("Enter Code : ");
                  System.out.flush();
                  code=obj.readLine();

                  System.out.print("Enter Name : ");
                  System.out.flush();
                  name=obj.readLine();
                 }
            catch(Exception e)
                {    }
        }
    
    void displayStaff()
    {
           System.out.println("\nCODE :  "+code);
           System.out.println("NAME  :  "+name);
    }
}

class teacher extends staff
{
         String subject,publication;
          void getTeacher()
           {   
                 getStaff();   //calling getStafftry{
                  BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
                  System.out.print("Enter Subject : ");
                  System.out.flush();
                  subject=obj.readLine();

                  System.out.print("Enter Publication : ");
                  System.out.flush();
                  publication=obj.readLine();
                  }
            catch(Exception e)
                {    }
          }
    
        void displayTeacher()
        {
            displayStaff();   //calling displayStaff
           System.out.println("SUBJECT :  "+subject);
           System.out.println("PUBLICATION  :  "+publication);
        }
}

class typist extends staff
{
        String speed;
         void getTypist()
         {   
            getStaff();   //calling getStafftry{
                  BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
                  System.out.print("Enter Speed : ");
                  System.out.flush();
                  speed=obj.readLine();
                  }
            catch(Exception e)
                {    }
        }
    
    void displayTypist()
    {
            displayStaff();   //calling displayStaff
           System.out.println("SPEED :  "+speed);
    }
}

class officer extends staff
{
     String grade;
      void getOfficer()
         {   
              getStaff(); //calling getStaff()try{
                  BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
                  System.out.print("Enter Grade : ");
                  System.out.flush();
                  grade=obj.readLine();
                  }
            catch(Exception e)
                {    }
        }
    
    void displayOfficer()
    {
           displayStaff();   //calling displayStaff
           System.out.println("GRADE :  "+grade);
    }
}


class regular extends typist
{
}

class casual extends typist
{
      String wages;
       void getCasual()
         {   
              getTypist(); //calling getTypist()try{
                  BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
                  System.out.print("Enter Daily Wages : ");
                  System.out.flush();
                  wages=obj.readLine();
                  }
            catch(Exception e)
                { }
        }
    
    void displayCasual()
    {
           displayTypist(); //calling displayTypist
           System.out.println("WAGES :  "+wages);
    }
}

class Education
{
      publicstaticvoid main(String args[])
      {

           int choice=1;
           String str;
           while(choice!=0){
                 System.out.println("\n\nChoose Your Choice...");
                 System.out.println("1) Teacher Details");
                 System.out.println("2) Typist Details ");
                 System.out.println("3) Officer Details");
                 System.out.println("Press 0 (ZERO) to exit ");
                 System.out.print("Enter your choice :  ");
                 System.out.flush();
                 try{
                       BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
                       str=obj.readLine();
                       choice=Integer.parseInt(str);
                }catch(Exception e) {}
                  
                  if(choice==0)
                  {
                      System.out.println("\n\nThanks for Visiting\nDo Visit next time....\n");
                       System.exit(1);
                  }

                 switch(choice){
                       case 1 :     System.out.println("\n=====TEACHER DETAILS=====");
                                         System.out.println("\nInputing Data");
                                         teacher obj_teacher=new teacher();
                                         obj_teacher.getTeacher();
                                         System.out.println("\nDisplaying Data");
                                         obj_teacher.displayTeacher();
                                         break;
                        case 2 :    System.out.println("\n=====TYPIST DETAILS=====\n");
                                         System.out.println("\nInputing Data");
                                         casual obj_casual=new casual();
                                         obj_casual.getCasual();
                                         System.out.println("\nDisplaying Data");
                                         obj_casual.displayCasual();
                                         break;
                        case 3 :    System.out.println("\n=====OFFICER DETAILS=====\n");
                                         System.out.println("\nInputing Data");
                                         officer obj_officer=new officer();
                                         obj_officer.getOfficer();
                                         System.out.println("\nDisplaying Data");
                                         obj_officer.displayOfficer();
                                         break; 
                        }
          }
    }
}
  
Share: 



Easy Tutor
Easy Tutor author of Program that maintains employee database of an education system is from United States. Easy Tutor says

Hello Friends,

I am Free Lance Tutor, who helped student in completing their homework.

I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.

I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] com

I have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada.

I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.

Thanks,
Happy Programming :)

 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!