import java.util.Scanner;
public class CollegeLists {
public static void main(String[] args){
CollegeLists college = new CollegeLists();
Scanner c = new Scanner(System.in);
int more=1;
do{
System.out.println("Press E for Employee, F for Faculty, or S for Student:");
String choice = c.nextLine().toUpperCase();
if(choice.equals("F")||choice.equals("E")||choice.equals("S")) {
System.out.println("Type Name and Contact Number (press enter after every input): ");
String nam = c.nextLine();
String con = c.nextLine();
Person pers = new Person(nam, con);
if (choice.equals("F")|| choice.equals("E")){
System.out.println("Type Monthly Salary and Department (press enter after every input): ");
double salry = c.nextDouble();
c.nextLine();
String departmnt = c.nextLine();
Employee emp = new Employee(salry, departmnt, pers.getName(), pers.getContactNum());
if (choice.equals("F")){
System.out.println("Are you Regular? Please enter Y for yes and N for no: ");
String tenure = c.nextLine().toUpperCase();
boolean tenre = false;
if(tenure.equals("Y")){
tenre = true;
} else {
tenre = false;
}
Faculty fac = new Faculty(tenre, salry, departmnt, nam, con);
college.print(pers);
college.printEmp(emp);
System.out.println("You are:\t" + fac.isRegular());
}else{
college.print(pers);
college.printEmp(emp);
}
}
if(choice.equals("S")){
System.out.println("Please enter your Program and Year Level (press enter after every input):: ");
String program = c.nextLine();
int year = c.nextInt();
Student stud = new Student(program, year, nam, con);
college.print(pers);
System.out.println("You are entrolled for:\t" + stud.getProgram());
System.out.println("Your year level is:\t" + stud.getYearLevel());
}
}
else {
System.out.println("Invalid input!");
System.out.println("Do you want to continue? Press 1 to continue");
more= c.nextInt();
c.nextLine();
}
}while(more==1);
}
public void print(Person pers){
System.out.println("..................................................");
System.out.println("Name:\t" + pers.getName());
System.out.println("Contact Number:\t" + pers.getContactNum());
}
public void printEmp(Employee emp){
System.out.println("Salary:\t" + emp.getSalary());
System.out.println("Department:\t" + emp.getDepartment());
}
}
public class Faculty extends Employee{
private boolean status;
public Faculty(boolean status, double salary, String department, String name, String contactNum){
super(salary, department, name, contactNum);
this.status = status;
}
public boolean isRegular(){
return status;
}
}
public class Person {
public String name;
public String contactNum;
public Person(String name, String contactNum){
this.name = name;
this.contactNum = contactNum;
}
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
public void setContactNum(String name){
this.contactNum = contactNum;
}
public String getContactNum(){
return contactNum;
}
}
public class Student extends Person {
private String program;
private int yearLevel;
public Student(String program, int yearLevel, String name, String contactNum){
super(name, contactNum);
this.program = program;
this.yearLevel = yearLevel;
}
public void setProgram(String program){
this.program = program;
}
public String getProgram(){
return program;
}
public void setYearLevel(int yearLevel){
this.yearLevel = yearLevel;
}
public int getYearLevel(){
return yearLevel;
}
}
public class Employee extends Person {
private double salry;
private String departmnt;
public Employee(double salry, String departmnt, String name, String contactNum){
super(name, contactNum);
this.salry = salry;
this.departmnt = departmnt;
}
public void setSalary(double salry){
this.salry = salry;
}
public double getSalary(){
return salry;
}
public void setDepartment(String departmnt){
this.departmnt = departmnt;
}
public String getDepartment(){
return departmnt;
}
}
import java.util.Scanner;
public class CollegeLists {
public static void main(String[] args){
CollegeLists college = new CollegeLists();
Scanner c = new Scanner(System.in);
int more=1;
do{
System.out.println("Press E for Employee, F for Faculty, or S for Student:");
String choice = c.nextLine().toUpperCase();
if(choice.equals("F")||choice.equals("E")||choice.equals("S")) {
System.out.println("Type Name and Contact Number (press enter after every input): ");
String nam = c.nextLine();
String con = c.nextLine();
Person pers = new Person(nam, con);
if (choice.equals("F")|| choice.equals("E")){
System.out.println("Type Monthly Salary and Department (press enter after every input): ");
double salry = c.nextDouble();
c.nextLine();
String departmnt = c.nextLine();
Employee emp = new Employee(salry, departmnt, pers.getName(), pers.getContactNum());
if (choice.equals("F")){
System.out.println("Are you Regular? Please enter Y for yes and N for no: ");
String tenure = c.nextLine().toUpperCase();
boolean tenre = false;
if(tenure.equals("Y")){
tenre = true;
} else {
tenre = false;
}
Faculty fac = new Faculty(tenre, salry, departmnt, nam, con);
college.print(pers);
college.printEmp(emp);
System.out.println("You are:\t" + fac.isRegular());
}else{
college.print(pers);
college.printEmp(emp);
}
}
if(choice.equals("S")){
System.out.println("Please enter your Program and Year Level (press enter after every input):: ");
String program = c.nextLine();
int year = c.nextInt();
Student stud = new Student(program, year, nam, con);
college.print(pers);
System.out.println("You are entrolled for:\t" + stud.getProgram());
System.out.println("Your year level is:\t" + stud.getYearLevel());
}
}
else {
System.out.println("Invalid input!");
System.out.println("Do you want to continue? Press 1 to continue");
more= c.nextInt();
c.nextLine();
}
}while(more==1);
}
public void print(Person pers){
System.out.println("..................................................");
System.out.println("Name:\t" + pers.getName());
System.out.println("Contact Number:\t" + pers.getContactNum());
}
public void printEmp(Employee emp){
System.out.println("Salary:\t" + emp.getSalary());
System.out.println("Department:\t" + emp.getDepartment());
}
}
public class Faculty extends Employee{
private boolean status;
public Faculty(boolean status, double salary, String department, String name, String contactNum){
super(salary, department, name, contactNum);
this.status = status;
}
public boolean isRegular(){
return status;
}
}
public class Person {
public String name;
public String contactNum;
public Person(String name, String contactNum){
this.name = name;
this.contactNum = contactNum;
}
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
public void setContactNum(String name){
this.contactNum = contactNum;
}
public String getContactNum(){
return contactNum;
}
}
public class Student extends Person {
private String program;
private int yearLevel;
public Student(String program, int yearLevel, String name, String contactNum){
super(name, contactNum);
this.program = program;
this.yearLevel = yearLevel;
}
public void setProgram(String program){
this.program = program;
}
public String getProgram(){
return program;
}
public void setYearLevel(int yearLevel){
this.yearLevel = yearLevel;
}
public int getYearLevel(){
return yearLevel;
}
}
public class Employee extends Person {
private double salry;
private String departmnt;
public Employee(double salry, String departmnt, String name, String contactNum){
super(name, contactNum);
this.salry = salry;
this.departmnt = departmnt;
}
public void setSalary(double salry){
this.salry = salry;
}
public double getSalary(){
return salry;
}
public void setDepartment(String departmnt){
this.departmnt = departmnt;
}
public String getDepartment(){
return departmnt;
}
}
ayan po boss sana matutlungan nyo po ako sallamat