L05

Due by the end of Tuesday, 9 February 2021


SUBMIT   /   CHECK
Download the following files:
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 InheritanceDemo:
Lecturer l1 = new Lecturer("Zachary"); Lecturer l1 = new Lecturer("Wilhelmina", 11017.00); l1.writeOutput(); l2.writeOutput(); pause(); l1.setName("Zack"); l1.setStipend(10800.00); l1.writeOutput(); pause(); System.out.printf("%s's stipend is $%4.2f.\n", g2.getName(), g2.getStipend());
Note: You do not need to submit your modified file InheritanceDemo. I know what it's supposed to look like!

Submit this/these files:

You will be graded on the following:

  1. Lecturer claims to be a subclass of Person
  2. ... has the required extra field(s)
  3. ... does not have any field(s) it shouldn't
  4. ... has the two-argument constructor
  5. ... ... that sets the name and stipend correctly
  6. ... has the one-argument constructor
  7. ... ... that sets the name and stipend correctly
  8. ... constructors show correct use of this(...) and super(...)
  9. ... has all the getters and setters it should
  10. ... but none it shouldn't
  11. ... has a writeOutput method that does what it should
  12. All code conforms to the style guidelines for the course

SUBMIT   /   CHECK