Question
HI THIS IS THE FOURTH TIME IM POSTING THIS QUESTION AND I NEED TO SOLVE THIS ASAP, PLEASE IF YOU DONT KNOW HOW TO DO
HI THIS IS THE FOURTH TIME IM POSTING THIS QUESTION AND I NEED TO SOLVE THIS ASAP, PLEASE IF YOU DONT KNOW HOW TO DO IT DO NOT POST IT SINCE NO ONE WAS ABLE TO SHOW ME A NICE RUNNING PROGRAM FOR THIS. I GOT ALL WRONG NON-RUNNING PROGRAMS, THANK YOU!
please help ASAP me with this JAVA program! and please do correct INDENTATION with NO COMMENTS! thank you!
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started