Question: public class ComunityDemo { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here

public class ComunityDemo { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner input = new Scanner( System.in ); String FName,LName,SSN,UnvId,Faculty,title,DoB, Hdate,degree,specality; int choice, level,i=0; char type; double salary; CommunityMember MyList[] = new CommunityMember[6]; do { System.out.print("1. Student " + "2. Faculty " + "3. Staff " + "4.Exit " + "Enter your choice >> "); choice = input.nextInt(); switch(choice) { case 1: System.out.print("***Enter student information*** First Name:"); FName = input.next(); System.out.print("Last Name:"); LName = input.next(); System.out.print("SSN:"); SSN = input.next(); System.out.print("**Date of birth**: "); DoB = input.next(); System.out.print("University ID:"); UnvId = input.next(); System.out.print("Faculty:"); Faculty = input.next(); System.out.print("Level:"); level = input.nextInt(); MyList[i]=new Student( FName, LName, SSN, DoB, UnvId, Faculty , level); i++; break; case 2: System.out.print("***Enter Faculty Information*** First Name:"); FName = input.next(); System.out.print("Last Name:"); LName = input.next(); System.out.print("SSN:"); SSN = input.next(); System.out.print("**Date of birth**: "); DoB = input.next(); System.out.print("Title:"); title = input.next(); System.out.print("Salary:"); salary = input.nextDouble(); System.out.print("**Hire Date**: "); Hdate = input.next(); System.out.print("Degree:"); degree = input.next(); System.out.print("Specality:"); specality = input.next(); MyList[i]=new Faculty( FName, LName, SSN, DoB, title, salary , Hdate,degree,specality); i++; break; case 3: System.out.print("***Enter Staff Information: First Name:"); FName = input.next(); System.out.print("Last Name:"); LName = input.next(); System.out.print("SSN:"); SSN = input.next(); System.out.print("**Date of birth**: "); DoB = input.next(); System.out.print("Title:"); title = input.next(); System.out.print("Salary:"); salary = input.nextDouble(); System.out.print("**Hire Date**: "); Hdate = input.next(); System.out.print("Type:"); type = input.next().charAt(0); MyList[i]=new Staff( FName, LName, SSN, DoB, title, salary , Hdate,type); i++; break; } }while (choice != 4); for( i=0 ; i
public class CommunityMember { private String FirstName; private String LastName; private String SSN; private String DoB; //date of birth public CommunityMember(String FName, String LName, String ssn, String dob) { FirstName = FName; LastName = LName; SSN = ssn; DoB = dob; } public void setFirstName(String fName) { this.FirstName = fName; } public String getFirstName() { return this.FirstName; } public void setLastName(String lName) { this.LastName = lName; } public String getLastName() { return this.LastName; } public String getFullName() { return (FirstName + " " + LastName); } public void setSSN(String ssn) { this.SSN = ssn; } public String getSSN() { return this.SSN; } public void setDoB(String dob) { this.DoB = dob; } public String getDoB() { return this.DoB; } @Override public String toString() { return String.format("Name: %s SSN: %s Date of Birth:%s",getFullName(), getSSN(), getDoB()); } // public abstract double earnings(); }
 
public class Employee extends CommunityMember{ private String Title; private double Salary; private String HireDate; public Employee(String FName, String LName, String ssn, String dob,String Title, double Sal, String HireDate) { super( FName, LName, ssn, dob); this.Title = Title; setSalary(Sal); this.HireDate = HireDate; } public void setTitle(String Title) { this.Title = Title; } public void setSalary(double Sal) { this.Salary = (Sal 
public class Faculty extends Employee { private String Degree; private String Specality; public Faculty(String FName, String LName, String ssn, String dob, String title, double salary, String hireDate,String degree,String specality) { super( FName, LName, ssn, dob,title,salary, hireDate ); this.Degree = degree; this.Specality = specality; } public void setDegree(String Degree) { this.Degree = Degree; } public void setSpecality(String Specality) { this.Specality = Specality; } public String getDegree() { return Degree; } public String getSpecality() { return Specality; } @Override public String toString() { return "Faculty{" + super.toString() + " Degree=" + Degree + ",Specality=" + Specality + '}'; } }
 
public class Staff extends Employee { private boolean FullTime; public Staff(String FName, String LName, String ssn, String dob, String Title, double Salary, String HireDate, char Type) { super(FName, LName, ssn, dob, Title, Salary, HireDate); this.FullTime = (Type == 'f' ) ? true : false; //f-->FullTime, p-->Parttime } public void setFullTime(boolean FullTime) { this.FullTime = FullTime; } public boolean isFullTime() { return FullTime; } @Override public String toString() { return "Staff{" + super.toString() + " working as " +(FullTime? "Full Time" : "Part Time") + '}'; } }
 
public class Student extends CommunityMember{
 private String UnvId; private String Faculty; private int Level; public Student(String FName, String LName, String ssn, String dob, String id, String faculty, int level) { super( FName, LName, ssn, dob); setFaculty(faculty); setUnvId(id); setLevel(level); } public void setUnvId(String UnvId) { this.UnvId = UnvId; } public void setFaculty(String Faculty) { this.Faculty = Faculty; } public void setLevel(int Level) { this.Level = Level; } public String getUnvId() { return UnvId; } public String getFaculty() { return Faculty; } public int getLevel() { return Level; } @Override public String toString() { return "Student " + super.toString() + " UnvId = " +UnvId + ", Faculty=" + Faculty + ", Level= " + Level ; } /*@Override public double earnings() { return 500.0; } */ }
 public class ComunityDemo { /** * @param args the command line

Edit class ComunityReme Add another option to the menu to enter and print Employee information1 2.display a main menu to the user to choose from the possible operations he can do (as follows) Your program should respond to the different choices as follows: 1.Add - Delete Display Info lear all CExit Enter your choice >> Add: display another menu to specify the lype of object he wants to create, input the data, and store in the List. Delete. ask the user about the index of the object to be deleted, remove the object from your list Display Info: print all the data of the objects in your list on the screen. Clear all delete the whole list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!