Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Person {
- String name;
- int dateOfBirth;
- public Person(String inputName, int inputDateOfBirth){
- name = inputName;
- dateOfBirth = inputDateOfBirth;
- }
- public String toString(){
- String dob = Integer.toString(dateOfBirth);
- return name;
- }
- }
- public class Student extends Person{
- public Student(String inputName, int inputDateOfBirth) {
- super(inputName, inputDateOfBirth);
- }
- String major;
- //sets major
- public void setMajor(String inputMajor){
- major = inputMajor;
- }
- }
- public class Instructor extends Person {
- int salary;
- public Instructor(String inputName, int inputDateOfBirth) {
- super(inputName, inputDateOfBirth);
- }
- public void setSalary(int inputSalary){
- salary = inputSalary;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment