L02

Due by the end of Wednesday, January 21

Starter Files:


SUBMIT   /   Submission Summary

Lab-02

Today's Activities

Start by downloading the starter files and running 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 ($9,144). 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());

Things to look out for:

Submit this/these files:


SUBMIT   /   Submission Summary