Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write in java please Create a class named Car. The data elements of the class are a String holding the car brand, is an integer

write in java please
Create a class named Car. The data elements of the class are a String holding the car brand, is an integer holding the weight of your car in kg and another String value holding the color of the car. The Car class must have both an argumentless constructor and a 3 argument constructor. The default values for the argumentless constructor should be ("no data", 0, "no data"). The class must have Set and Get methods. Also the class should have a method called display and this The method should output something like the following, for example.
The weight of the car, whose brand is Ford, is 1200 kilos and its color is green.
Also, there must be another class called ElectricCar, and this class must be a subclass of the Car class. The type of this class that keeps the charging time of the car's battery is called rechargeHour, which is an integer. must be a data item. This class again has an argumentless constructor and four arguments in one. Configurator must exist. The default value for the argumentless constructor should be 10. your class Set and Get methods must exist for the data item. Also, the class must have a display method. The output of the display method is for example The weight of the car, whose brand is Ford, is 1200 kilos and its color is green. The car is charging in 3 hours should be in the form.
At least two electric car types must be defined within the ElectricCar Test class and their values must be printed.

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions