Question: pls use java as easy as possible, since I'm a first-year student, and pls tell me what are the file name for java sources Problem
pls use java as easy as possible, since I'm a first-year student, and pls tell me what are the file name for java sources
Problem 1: Car Class.
Design a Car class that has the following members: a field for the name of the car (a String), a field for the year (a String), a constructor and appropriate accessor and mutator methods, a toString method that displays the car's name and the year it was built.
Design a SUVCar class that extends the Car class. The SUVCar class should have the following members: A field for the type of engine, (four-cylinder or six-cylinder) (a String), a constructor and appropriate accessor and mutator methods, a toString method that overrides the toString method in the super class. The SUVCar class's toString method should display only the car's name and the type of engine.
Demonstrate/test the classes in a program: Create two Car variables and one SUVCar variable. Assign a Car object to the first Car variable, a SUVCar object to the second Car variable and a different SUVCar object to the SUVCar variable. Call all the methods available for each variable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
