Class license

by | Nov 11, 2021 | Assignment

Define a class License. A License has a license number and an expiration date (I suggest using java.time.LocalDate, but there are other possibilities). Then do the following:

(a) Think what it might mean for two License instances to represent the same real- world license. Write the Boolean equals method that takes another License as argument and returns true if the two Licenses are “equal” in this sense. The block comment for your method should explain how you are doing the comparison.

(b) Write a Boolean method expired that returns true if the current date is after the expiration date of the License, otherwise false.

(c) Define the class Drivers License as a subclass of License. In addition to the properties of a License, a Drivers License also has the state that issued the license (you can use a string for this).

(d) Suppose that driver’s licenses from different states may have the same license number. Override the equals method for Drivers License to do the right thing when testing if two Drivers Licenses are equal.

(e) Define the class Truck Drivers License that extends Drivers License. Override the to String method to return a meaningful description of an instance.

(f) Define the class Fishing License which extends License. In addition to the properties of a License, a Fishing License specifies what types of may be caught (you can use a string for this). Override the to String method. Illustrate all of these with a main method in a separate test class.

We help you get better grades, improve your productivity and get more fun out of college!!

Homework Answers Online

Free title page

Free reference page

Free formatting

Unlimited revisions

Achieve academic success with the best online tutors