package dealership; public abstract class Vehicle { private float dealerPrice; ...

80.2K

Verified Solution

Question

Programming

package dealership;public abstract class Vehicle {  private float dealerPrice;  private int year;  public Vehicle(float d, int y) { dealerPrice = d; year = y; }
  public float getDealerPrice()         { return dealerPrice; }  public int getYear()             { return year; }
  public abstract float getStickerPrice();
}

In the space below write a concrete class Carin the dealership package that is a subclass ofVehicle class given above.

You will make two constructors, both of which must callthe superclass constructor. Make a two argumentconstructor (float, int) thatinitializes both instance variables using the arguments (thinkcarefully about how this should be done). Make a single argumentconstructor (float) that initializes thedealerPrice with the float argument andinitializes year to the current year (2020).Override the getStickerPrice()method so that itreturns 1.5 times the dealerPrice if the year isat least 2010, and returns 1.2 times thedealerPrice if the year is older than 2010 (thatis, year < 2010).

Answer & Explanation Solved by verified expert
4.3 Ratings (865 Votes)
Thanks for the question Below is the code you will be needing Let me know if you have any doubts or if you need anything to change If you    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students