I need help with this Java Problem as described in the image below: public class Person { private int ageYears; private String lastName; public void setName(String userName) { lastName = userName; } public void setAge(int numYears) { ageYears = numYears; } // Other parts omitted public void printAll() { System.out.print("Name: " + lastName); System.out.print(", Age: " + ageYears); } } // ===== end ===== // ===== Code from file Student.java ===== public class Student extends Person { private int idNum; public void setID(int studentId) { idNum = studentId; } public int getID() { return idNum; } } // ===== end ===== // ===== Code from file StudentDerivationFromPerson.java ===== public class StudentDerivationFromPerson { public static void main(String[] args) { Student courseStudent = new Student(); /* Your solution goes here */ } }
I need help with this Java Problem as described in the image below:
public class Person {
private int ageYears;
private String lastName;
public void setName(String userName) {
lastName = userName;
}
public void setAge(int numYears) {
ageYears = numYears;
}
// Other parts omitted
public void printAll() {
System.out.print("Name: " + lastName);
System.out.print(", Age: " + ageYears);
}
}
// ===== end =====
// ===== Code from file Student.java =====
public class Student extends Person {
private int idNum;
public void setID(int studentId) {
idNum = studentId;
}
public int getID() {
return idNum;
}
}
// ===== end =====
// ===== Code from file StudentDerivationFromPerson.java =====
public class StudentDerivationFromPerson {
public static void main(String[] args) {
Student courseStudent = new Student();
/* Your solution goes here */
}
}


Step by step
Solved in 3 steps with 1 images









