kandjstephens6618 kandjstephens6618
  • 21-12-2020
  • Computers and Technology
contestada

Write a class that specify the characteristics of a car, like type (sedan, jeep, mini, SUV, etc), gear (auto, manual), maximum speed (mph), average fuel consumption (mpg), etc. Create few objects to illustrate your desired cars.

Respuesta :

Jamesanny20
Jamesanny20 Jamesanny20
  • 22-12-2020

Answer:

Answered below

Explanation:

This is written in Kotlin programming language.

//Creating the class Car. The primary //constructor declares car's properties which //are initialized when it's objects are created.

class Car(

val type: String,

val gear: String,

val maxSpeed: Double,

val avgFuelConsumption: Double)

//Creating several objects of car.

val sedan: Car = Car("sedan", "auto", 23.4, 500)

val jeep: Car = Car("jeep", "manual", 40, 350)

val mini: Car = Car("mini", auto, 26.7, 86, 234)

Answer Link

Otras preguntas

The equation of a line is y=1.5 x-2. What are its slope and y-intercept ?
Molly went to her grandmother's house for 16 hours last weekend. This was four times longer than the time she spent at her grandmother's this weekend. How many
What is 22,900 written in a scientific notation
How many daughter cells are created at the end of meiosis 1?
Would the individuals in the following scenario constitute a group? -cast of a play A- yes B- no
Heyy ! I need help , how does one find the volume of an octagonal prism ?
Which part of the Magna Cart is reflected in the US Constitution?
pedigree worksheet answers how do scientist trace hereditary disease through a family history
Where does DNA replication occurs during the school cycle? Why?
which of the following was most likely not present in creating the amino acids of early earths water of the past? A. sulfurB. nitrogenC. hydrogenor D. ammonia​