Question: You will create a class Vehicle. The class should have five instance fields: make (Chevy, Ford, Toyota, Nissan, Hyundai) model (compact, intermediate, fullSized, SUV) weight
You will create a class Vehicle. The class should have five instance fields: make (Chevy, Ford, Toyota, Nissan, Hyundai) model (compact, intermediate, fullSized, SUV) weight (double), engineSize (double) and import (boolean).
Your program should also automate creation of a number of instances of vehicles. Your program should create ten vehicles by randomly selecting makes and models from the above enumerations, and randomly select weights between 1500 and 4000 pounds. Weights must be such that compact cars (1500-2000) weigh less than intermediate cars (2000-2500) and intermediate cars weigh less than the rest. SUVs, full-sized cars, pickups and vans are all in the same weight range (2500-4000). Toyota, Nissan, and Hyundai are imports.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
