Question: please help me with this JAVA program! Using enum and array of objects Use the enumerated type of: enum CarType { PORCHE, FERRARI, JAGUAR, UNKNOWN

please help me with this JAVA program!

Using enum and array of objects

Use the enumerated type of: enum CarType { PORCHE, FERRARI, JAGUAR, UNKNOWN }

And place it in its own file. Then make a Car class that has the following:

Make of CarType

Year, string or integer

Mileage of integer

Place in its own file like so:

porche

2010

51119

ferrari

2014

9182

porche

2015

3987

jaguar

2011

65123

Create a program that will have an array of four cars of Car class. Have it use a while loop to read in the information per car (use the enhanced switch to convert the string of the make into CarType dont forget about the phantom newline), allocate each Car object and put the information into that object. Then have a for loop go through the array, print the Car objects, and total the mileage. After the for loop ends, print the average mileage.

Sample run:

Honest Georges Used Sports Cars

Car 1 is a 2010 FERRARI with 51119 miles on it

Car 2 is a 2014 JAGUAR with 9182 miles on it

Average mileage is 32352.8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!