Complete the following program using the following classes and interface Declare
ID: 3917415 • Letter: C
Question
Complete the following program using the following classes and interface
Declare and define all functions / variables. ( JAVA )
public abstract class Person{
// create a protected String variable called name
// create a constructor with one String parameter called name
// create an abstract function called getIdentification that returns a String
}
public class Professor extends Person{
// create a private String variable called departement
// create a constructor with two string parameters ( name & departement)
// override getIdentification function by returning name and the departementof the Professor
}
public class Undegrade extends Person implements Students{
// create a protected string variable called major
// create a constructor with two parameters to initilize name and major
// override getIdentification function by returning name and the focus of Undergrad as one string
// override enroll function by returning the string " Enroll Success "
}
// create an interface called Student and add a function called enroll that returns a string
Explanation / Answer
public abstract class Person {
// create a protected String variable called name
protected String name;
Person(String name) {
this.name = name;
}
// create a constructor with one String parameter called name
// create an abstract function called getIdentification that returns a String
public abstract String getIdentification();
}
public class Professor extends Person {
// create a private String variable called departement
private String departement;
// create a constructor with two string parameters ( name & departement)
Professor(String name, String departement) {
super(name);
this.departement = departement;
}
@Override
public String getIdentification() {
// TODO Auto-generated method stub
return name + " : " + departement;
}
// override getIdentification function by returning name and the departementof
// the Professor
}
interface Students {
public String enroll();
}
// create an interface called Student and add a function called enroll that
// returns a string
public class Undegrade extends Person implements Students {
// create a protected string variable called major
protected String major;
// create a constructor with two parameters to initilize name and major
Undegrade(String name, String major) {
super(name);
this.major = major;
}
// override getIdentification function by returning name and the focus of
// Undergrad as one string
@Override
public String getIdentification() {
// TODO Auto-generated method stub
return name + " : " + major;;
}
public String enroll() {
return " Enroll Success ";
}
// override enroll function by returning the string " Enroll Success "
}
Did EveryThing. Have a Look. Thanks, PLEASE UPVOTE
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.