You are on page 1of 3

package collegelist;

import java.util.Scanner;

public class CollegeList extends Person{


    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        System.out.print("Press E for Employee, F for Faculty, or S for Student: ");


        String userInput = sc.nextLine();

         if (userInput.equalsIgnoreCase("E")) {
            System.out.println("Type employee's name, contact number, salary and department.");
            System.out.println("Press Enter after every input.");
      
            Employee e = new Employee();

            e.setName(name);
            e.setContactNum(contactNum);
            e.setSalary(salary);
            e.setDepartment(dep);
        
        } else if (userInput.equalsIgnoreCase("F")) {
            System.out.println("Type faculty's name, contact number, salary, department.");
            System.out.println("Press Enter after every input.");

            Faculty f = new Faculty();


      
            System.out.println("Press [Y] if the faculty member is regular/tenured or [N] if not.");
            String select = sc.nextLine();
      
            f.setName(name);
            f.setContactNum(contactNum);
            f.setSalary(salary);
            f.setDepartment(dep);
      
            if (select.equalsIgnoreCase("Y")) {
                f.setStatus(true);
            } else if (select.equalsIgnoreCase("N")) {
                f.setStatus(false);
      }
        } else if (userInput.equalsIgnoreCase("S")) {
            System.out.println("Type student's name, contact number, program and year level.");
            System.out.println("Press Enter after every input.");
      

            s.setName(name);
            s.setContactNum(contactNum);
            s.setProgram(program);
            s.setYearLevel(yearLevel);
      
            System.out.println("------------------------------");
    }

  }
}
package collegelist;

class Person {
    private String name;
    private String contactNum;

    public void setName(String n){


        name = n;
  }

    public String getName(){


        return name;
  }

    public void setContactNum(String c){


        contactNum = c;
  }

    public String getContactNum(){


        return contactNum;
  }

package collegelist;

class Employee extends Person{

    private double salary;


    private String department;

    public void setSalary(double s){


        salary = s;
  }

    public double getSalary(){


        return salary;
  }

    public void setDepartment(String d){


        department = d;
  }

    public String getDepartment(){


        return department;
    } 

package collegelist;

class Student extends Person {


    private String program;
    private int yearLevel;
  
    public void setProgram(String p){
        program = p;
  }
    public String getProgram(){
        return program;
  }

    public void setYearLevel(int y){


        yearLevel = y;
  }

    public int getYearLevel(){


        return yearLevel;
  }

package collegelist;

class Faculty extends Employee{


    private boolean status;
  
    public boolean isRegular(){
        return status;
  }

    public void setStatus(boolean s){


        status = s;
  }
  
}

You might also like