Question: inheretanceDemo Person Download the following files: Inheritance Demo java Person.java Student.java Undergrad.java Examine the code and run the program (InheritanceDemo) to see how it works.

 inheretanceDemo Person Download the following files: Inheritance Demo java Person.java Student.javainheretanceDemo
Undergrad.java Examine the code and run the program (InheritanceDemo) to see howPerson
it works. Programming Activity 1 Create a new class, Lecturer, that extends

Download the following files: Inheritance Demo java Person.java Student.java Undergrad.java Examine the code and run the program (InheritanceDemo) to see how it works. Programming Activity 1 Create a new class, Lecturer, that extends Person. A Lecturer is a Person with a stipend (a double value representing how much that lecturer will be paid for teaching a course). Create a constant for the default stipend (10,165). Create two constructors for the class: one accepts a name and stipend amount; the other accepts just a name and uses the default stipend. Include any appropriate getters/setters. Programming Activity 2 Give your Lecturer class a writeOutput method, which produces output like this: Name: (name) Stipend: $(stipend) Programming Activity 3 Test your Lecturer class by adding the following code to main in Inheritance Demo: Lecturer 11 = new Lecturer ("Zachary"); Lecturer 11 - new Lecturer ("Wilhelmina", 11.writeOutput(); 12.writeOutput(); pause(); 11.setName ("Zack"); 11.setStipend (10800.00); 11.writeOutput(); pause(); System.out.printf("%s's stipend is $94.2 Note: You do not need to submit your modified file package 105; import java.util.Scanner; A program to demonstrate inheritance using a simple hierarchy. Bauthor Hark Young (A00000000) public class Inheritancebemo private statie fnal Scanner kad new Scanner(Systen.se); public static void main(String 1 args) System.out.println(); // basic person doing personny things Person P = new Person("Pat"): Systen.out.println(" pp): p.setNane("Pat Patterson); System.out.println(p = p): pause); Il basic student doing studenty things // (including personny things) Students - new Student ("Warren); System.out.println(" ss); 3.setName("Warren Peace"); 3. Set Grade (90); System.out.println(s); System.out.println(s.getName()+'s grade is + 8.getGrade(); pause(); W basic undergrad doing undergraddy things 1/ (including studenty personny things) Undergradu-nex Undergrad("Stu; System.out.println("); w.setNanoStu Dent); u. set Grade(100): u. setYear (2); System.out.println("") System.out.println(u.getName() *'s grade is + u.getGrade()); System.out.println(u.getName() Is in year u.getYear()) pause(); // Activity A delete this line and the one marked below) for activity ) -- Lecturer 12 - new Lecturer"Wilhelsisa, 11017.00) 11.writeOutput(); 12.vriteOutput) pause) 11.setName("ack) 11.setStipend(10800.00); 11.writeoutput(); pause(); System.out.printf("s's stipend is $1.4.2.1". 11.getName). 11. getstipend()); System.out.print('s stipend is 51.4.21. n. 12.getName(), 12.getStipend()); pause(); - delete this line (and the one marked above) for activity 3 -- > Prompt the user and wait for them to press the enter key. private static void pause() { System.out.print(" press enter..."); XBD.nextLine(); System.out.println(); } > Root class for a simple inheritance hierarchy. This class has both public and private methods Student extends this elass. auther Mark Toung (A0000000) public class Person /** Every person has a name private String nane Person requires a name parama the Person's pubite Person(string name) } Return this person's name return this person's name / publie string geta return this.name; } Change this person's name param newlane this person's new name publle void setName(String newlane) this.a - see > * A Bethod for children classes to herit poblic void publiceronethod) Syaten.out.println"Vein publicpersonitethod for this.name): A method for children classes to inherit calling Private System.out.printlarvtin callingerivater Honnethod for this...) System.out.printintcallingPrivate Person Method done A method children classes can't call directly private void private Person Method System.out.printlnttitin privatelerethod for A method for children classes to replace entirely. public void replacedtethod) System.out.printi tin replaced ethod for Person A method for children classes to add to publie void revisedtethod System.out.println("\tin revistethod for Person this.name) } A method to represent this person using a string treturn a string representing this person Override publle string tostring) return an

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!