course mod topic first name date completed
cit-244 wk. 3 abstract classes and interfaces
java master sequence > abstract classes and interfaces

Abstract classes and interfaces: Ch. 15

Use cases for "plain" inhertiance: subclass extending a super class

Use cases for abstract methods (which make for abstract classes)

Use cases for interfaces

Abstract class inheritance project

program objective

Demonstrate the value of creating an abstract superclass, forcing sublcasses to implement all abstract methods of its parent

program requirement 1

We modeled abstract classes and inheritance trees using the Computer top-level class. To test our knowledge and build out our modeling program, create a second inheritance hierarchy whose top-level class is User. Its subclasses should include at least an AdminUser and a PublicUser. Create a handful of meaningful member variables for each super and subclass.

program requirement 2

Refactor your Computer class to include two methods, each typed to one of the subclasses of User. For example, create a method called changeAdminSettings(AdminUser us) which simulates an administrator changing a system configuration switch somehow. Similarly, create a method like lookUpUnrestrictedData(PublicUser pubus) which simulates some trivial retrieval of some database data.

program requirement 3

Create an interface called something like Authenticatable that specifies methods called String getPassword() and String getUserName(). Write companion methods on your Computer class or subclasses which accepts Authenticatable objects and simulates asking them for a username and password and pretends to check against a database.