Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class called Student that extends the provided Person class. Ensure that

ID: 3936468 • Letter: W

Question

Write a class called Student that extends the provided Person class. Ensure that your student class is a concrete class. The foo method for a person should display (to standard output) the person's age and name in a nice way (e.g, "Nigel's age is 14"). When a person makes a noise it is their name repeated N times where N is the person's age.

public abstract class Person implements Noisy Person Class public String name; 3 ublic int age; s public abstract void foo); public interface Noisy 2 String noise) 1 public interface Noisy{ Noisy Interface 1 public interface Comparable 2 i Comparable Interface int compareTo(Type other); 1 public class Date 2 int day, month, year; Date Class public Date(int d, int m, int y){ dayd; month - m; year-y;

Explanation / Answer

public class Student extends Person{

Student(String name, int age){

this.name = name;                                               // initialising the student properties

this.age = age;

}

public void foo(){

if(isNoisy()){                               //check if person makes noise

for(int i=0 ; i< age; i++ ){

System.out.print(" "+name+" ");

}

}else{

System.out.println(name+"'s age is "+age);

}

}

}

// Note: Information about the Noisy class is required.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote