Question: 1. Write the class Car which includes: a) 3 attributes: unique number plate (e.g. ABC123), brand (e.g. Toyota) and rental rate (e.g. $20). b)
1. Write the class Car which includes: a) 3 attributes: unique number plate (e.g. ABC123), brand (e.g. Toyota) and rental rate (e.g. $20). b) a zero-arg constructor and a mutli-arg constructor. c) Getter for brand attribute and setter for rate attribute. d) toString() method which overrides the Object's toString() method. e) equals() method which overrides the Object's equals() method. f) compareTo() method which implements the Comparable's compareTo() method. You should use the number plate only in the comparison.
Step by Step Solution
There are 3 Steps involved in it
Certainly lets write a Java class Car that satisfies all the requirements listed in the question Here is how the class might look like java public cla... View full answer
Get step-by-step solutions from verified subject matter experts
