revise and show the output  import java.util.Scanner; class Person {  //declaring instance variables  private String name;  private String contactNum;    //setters and getters  public void setName(String n) {   this.name = n;  }    public String getName() {   return name;  }    public void setContactNum(String c) {   this.contactNum = c;  }    public String getContactNum() {   return contactNum;  } } class Employee extends Person {  //declaring instance variables  private double salary;  private String department;    //setters and getters  public void setSalary(double s) {   this.salary = s;  }    public double getSalary() {   return salary;  }    public void setDepartment(String d) {   this.department = d;  }    public String getDepartment() {   return department;  } } class Faculty extends Employee {  //declaring instance variable  private boolean status;    //method implementation  public boolean isRegular() {   return status;  } } class Student extends Person {  //declaring instance variables  private String program;  private int yearLevel;    //setters and getters  public void setProgram(String p) {   this.program = p;  }    public String getProgram() {   return program;  }    public void setYearLevel(int y) {   this.yearLevel = y;  }    public int getYearLevel() {   return yearLevel;  } } public class CollegeList {    public static void main(String[] args) {      Scanner sc=new Scanner(System.in);      System.out.print("Press E for Employee, F for Faulty, S for Student: ");   String choice=sc.nextLine(); //input choice      if(choice.equalsIgnoreCase("E")) { //if choice is E/e        System.out.println("Type employee's name, contact number, salary and department");    System.out.println("Press Enter after every input");        //read values from user    String name=sc.nextLine();      String contactNum=sc.nextLine();    double salary=Double.parseDouble(sc.nextLine());    String department=sc.nextLine();        Employee e=new Employee();        //set values    e.setName(name);    e.setContactNum(contactNum);    e.setSalary(salary);    e.setDepartment(department);        //print all values    System.out.println("--------------------------");    System.out.println("Name: "+e.getName());    System.out.println("Contact Number: "+e.getContactNum());    System.out.println("Salary: "+e.getSalary());    System.out.println("Department: "+e.getDepartment());       }else if(choice.equalsIgnoreCase("F")) { //if choice is F/f    System.out.println("Type faculty' name, contact number, salary and department");    System.out.println("Press Enter after every input");        //read values from user    String name=sc.nextLine();      String contactNum=sc.nextLine();    double salary=Double.parseDouble(sc.nextLine());    String department=sc.nextLine();        System.out.print("Enter Y if regular or N for Tenured: ");    boolean status=sc.nextLine().equals("Y");        Faculty f=new Faculty();        //set values    f.setName(name);    f.setContactNum(contactNum);    f.setSalary(salary);    f.setDepartment(department);        //print all values    System.out.println("--------------------------");    System.out.println("Name: "+f.getName());    System.out.println("Contact: "+f.getContactNum());    System.out.println("Salary: "+f.getSalary());    System.out.println("Department: "+f.getDepartment());    System.out.println("Status: "+status);       }else if(choice.equalsIgnoreCase("S")) { //if choice is S/s    System.out.println("Type student's name, contact number, program and year level");    System.out.println("Press Enter after every input");        //read input values    String name=sc.nextLine();      String contactNum=sc.nextLine();    String program=sc.nextLine();    int yearLevel=sc.nextInt();        Student s=new Student();        //set all values    s.setName(name);    s.setContactNum(contactNum);    s.setProgram(program);    s.setYearLevel(yearLevel);        //print all values    System.out.println("--------------------------");    System.out.println("Name: "+s.getName());    System.out.println("Contact Number: "+s.getContactNum());    System.out.println("Program: "+s.getProgram());    System.out.println("Year: "+s.getYearLevel());       }else    System.out.println("Invalid Choice");  } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

revise and show the output 

import java.util.Scanner;

class Person {
 //declaring instance variables
 private String name;
 private String contactNum;
 
 //setters and getters
 public void setName(String n) {
  this.name = n;
 }
 
 public String getName() {
  return name;
 }
 
 public void setContactNum(String c) {
  this.contactNum = c;
 }
 
 public String getContactNum() {
  return contactNum;
 }
}

class Employee extends Person {
 //declaring instance variables
 private double salary;
 private String department;
 
 //setters and getters
 public void setSalary(double s) {
  this.salary = s;
 }
 
 public double getSalary() {
  return salary;
 }
 
 public void setDepartment(String d) {
  this.department = d;
 }
 
 public String getDepartment() {
  return department;
 }
}

class Faculty extends Employee {
 //declaring instance variable
 private boolean status;
 
 //method implementation
 public boolean isRegular() {
  return status;
 }
}

class Student extends Person {
 //declaring instance variables
 private String program;
 private int yearLevel;
 
 //setters and getters
 public void setProgram(String p) {
  this.program = p;
 }
 
 public String getProgram() {
  return program;
 }
 
 public void setYearLevel(int y) {
  this.yearLevel = y;
 }
 
 public int getYearLevel() {
  return yearLevel;
 }
}

public class CollegeList {
 
 public static void main(String[] args) {
  
  Scanner sc=new Scanner(System.in);
  
  System.out.print("Press E for Employee, F for Faulty, S for Student: ");
  String choice=sc.nextLine(); //input choice
  
  if(choice.equalsIgnoreCase("E")) { //if choice is E/e
   
   System.out.println("Type employee's name, contact number, salary and department");
   System.out.println("Press Enter after every input");
   
   //read values from user
   String name=sc.nextLine();  
   String contactNum=sc.nextLine();
   double salary=Double.parseDouble(sc.nextLine());
   String department=sc.nextLine();
   
   Employee e=new Employee();
   
   //set values
   e.setName(name);
   e.setContactNum(contactNum);
   e.setSalary(salary);
   e.setDepartment(department);
   
   //print all values
   System.out.println("--------------------------");
   System.out.println("Name: "+e.getName());
   System.out.println("Contact Number: "+e.getContactNum());
   System.out.println("Salary: "+e.getSalary());
   System.out.println("Department: "+e.getDepartment());
   
  }else if(choice.equalsIgnoreCase("F")) { //if choice is F/f
   System.out.println("Type faculty' name, contact number, salary and department");
   System.out.println("Press Enter after every input");
   
   //read values from user
   String name=sc.nextLine();  
   String contactNum=sc.nextLine();
   double salary=Double.parseDouble(sc.nextLine());
   String department=sc.nextLine();
   
   System.out.print("Enter Y if regular or N for Tenured: ");
   boolean status=sc.nextLine().equals("Y");
   
   Faculty f=new Faculty();
   
   //set values
   f.setName(name);
   f.setContactNum(contactNum);
   f.setSalary(salary);
   f.setDepartment(department);
   
   //print all values
   System.out.println("--------------------------");
   System.out.println("Name: "+f.getName());
   System.out.println("Contact: "+f.getContactNum());
   System.out.println("Salary: "+f.getSalary());
   System.out.println("Department: "+f.getDepartment());
   System.out.println("Status: "+status);
   
  }else if(choice.equalsIgnoreCase("S")) { //if choice is S/s
   System.out.println("Type student's name, contact number, program and year level");
   System.out.println("Press Enter after every input");
   
   //read input values
   String name=sc.nextLine();  
   String contactNum=sc.nextLine();
   String program=sc.nextLine();
   int yearLevel=sc.nextInt();
   
   Student s=new Student();
   
   //set all values
   s.setName(name);
   s.setContactNum(contactNum);
   s.setProgram(program);
   s.setYearLevel(yearLevel);
   
   //print all values
   System.out.println("--------------------------");
   System.out.println("Name: "+s.getName());
   System.out.println("Contact Number: "+s.getContactNum());
   System.out.println("Program: "+s.getProgram());
   System.out.println("Year: "+s.getYearLevel());
   
  }else
   System.out.println("Invalid Choice");
 }
}

Output - PersonDemo2 (run) - Editor
Output - PersonDemo2 (run)
run:
DD
Press E for Employee, F for Faculty, or S for Studnent : f
Type Faculty's name, contact number, salary, department
status (y/n).
Press Enter after every input
Kevin Henry
852369741
9658
Computer Science
Name
: Kevin Henry
Contact Number : 852369741
Salary : 9658.0
Department : Computer Science
Status : regular
BUILD SUCCESSFUL (total time: 44 seconds)
Transcribed Image Text:Output - PersonDemo2 (run) - Editor Output - PersonDemo2 (run) run: DD Press E for Employee, F for Faculty, or S for Studnent : f Type Faculty's name, contact number, salary, department status (y/n). Press Enter after every input Kevin Henry 852369741 9658 Computer Science Name : Kevin Henry Contact Number : 852369741 Salary : 9658.0 Department : Computer Science Status : regular BUILD SUCCESSFUL (total time: 44 seconds)
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education