Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

3. How could burnout have a good side? What may be a benefit?

Answered: 1 week ago