View the step-by-step solution to:

Create a Car class and a subclass Certified PreOwn Car class that inherits from Car based on the following UML diagram :" year . int make :...

I need help with writing the java programs described in the screen shots.


ScreenHunter 25.pngScreenHunter 26.png

ScreenHunter 25.png

1 . Create a Car class and a subclass Certified PreOwn Car class that inherits from Car based on the following UML diagram :"
year . int
make : String
model - String
current Miles_ int
warranty Miles : int
warranty Years :"
Car( year : int , make : String , model - String : current Miles ; int )
getWarranty Miles ( ) : int*
setWarranty Miles ( miles : int ) : void*
getWarranty Years : int
setWarranty Year ( years : int ) : void
check Warranty Status ( ) : void*
is Covered Under Warranty ( ) _ boolean
- memberName*
extendedwarranty Years : int
extended warranty Miles : int*
Certified Pre Own Car ( year - int , make String , model : String . current Miles : int )
get Extended Warranty Miles ( ) ; int*
set Extended Warranty Miles ( miles : int ) : void
get Extended Warranty Years : int*
set Extended Warranty Year ( years : int ) : void
is Covered Under Warranty ( ) : boolean*
Both Car and Certified Pre Own Car have a is Covered Under Warranty ( method , which returns a boolean . This method will determine whether the car is
covered under warranty based on coverage years and miles , whichever comes first . check Warranty Status ( ) method will print warranty information to
inform the user whether the car is under warranty or not .

ScreenHunter 26.png

-2. Create a test program called TestCar. Create different Car objects and CertifiedPreOwnCar objects and invoke the checkWarranty() method on them.
Below is my test program's main method code snippet:
Car m6 = new Car(2014, "BMW", "M6", 0);
m6.setWarrantyYears(4);
m6.setWarrantyMiles(50000);
m6.checkWarrantyStatus();
Car nsx = new Car(1991, "Acura", "NSX", 20000);
nsx.setWarrantyYears(3);
nsx.setWarrantyMiles(36000);
nsx.checkWarrantyStatus();
CertifiedPreOwnCar accord = new CertifiedPreOwnCar(2010, "Honda", "Accord", 45000);
accord.setWarrantyYears(3);
accord.setWarrantyMiles(36000);
accord.setExtendedWarrantyMiles(100000);
accord.setExtendedWarrantyYears(6);
accord.checkWarrantyStatus();
When I run my program, I saw the following output:
c. Administrator: Command Prompt
Ox
C: \IS2 300\Module3>java TestCar
four car 2014 BMW M6 with 0 miles is still covered under warranty.
Your car 1991 Acura NSX with 20000 miles is out of warranty.
Your car 2010 Honda Accord with 45000 miles is still covered under warranty.
C: \IS2 300\Module3>

Top Answer

Specification given in question tests whether the car is still covered under warranty or not. Here the parameters used to... View the full answer

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online