Friday 2/11 Announcements: ▪ Homework 1 due Today – submit to Sakai ▪ Lab 1 due Monday, 2/14 – submit to Sakai (instructions on 270 website) ▪ Poll – Have you used ArrayList<>?? ▪ Quiz 1 next Friday, 2/18 ▪ Summer Internship opportunity with Pacific Northwest National Labs [PLU-CS-group] Next time ▪ Read Sections 1.4 and 1.5 ➢ Difference between Interface, Abstract class, and Concrete class ➢ Casting and instanceof Today: ▪ Questions on Reading Sections 1.2-1.3 or Homework ▪ UML Diagrams ▪ Superclass, subclass and Inheritance ▪ Overloading, Overriding, and Polymorphism ▪ Eclipse coding if time permits – create a class and subclass from a UML UML Diagram ▪ Create UML Diagram for an Employee class ➢Data/Attributes/Fields • id • name ➢Operations/Methods • Constructor • getName, getId • setName • toString Employee UML ▪ Create the Employee class using the Employee UML Diagram UML Superclass Subclass - Questions For classes Employee and HourlyEmp ▪ What is the relationship between the classes (superclass, subclass) and what is inherited? ▪ What is the main purpose of a constructor? ▪ What is significance of # visibility ▪ What is a no-parameter (default) constructor? ▪ What is the relationship between superclass and subclass constructors? ▪ What is overriding? ▪ What is overloading? ▪ What is polymorphism? Employee e1 = ?? e1.toString() Employee Class ▪ What is the header for the Employee class? ▪ What is the header for the HourlyEmp class? ▪ What is the header for the SalariedEmp class? ▪ Suppose we have a class EmployeeTestMain with a main method. How do we create an array or an ArrayList to hold any type of employee? Superclass variables subclass objects Object o = new ????? Animal a = new ????? Cat c = (???????) a; is-a has-a In-class Exercises ▪ Start Eclipse and Create a new Java Project: PracticeEmployee ▪ Create the class Employee ▪ Create the subclass HourlyEmp ▪ Create the subclass SalariedEmp (if time permits) ▪ Create the class EmployeeTestMain with a main method ▪ Create an Employee array or an ArrayList▪ Add some Employees / HourlyEmp / SalariedEmp to the array