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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started