Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Approach Create your struct ( I will call it CarData but you can name it whatever you want ) . The struct should have the
Approach
Create your struct I will call it CarData but you can name it whatever you want The struct should have
the following characteristics if not explicitly stated, you get to choose:
Gas should be an enumerated type
o define the enumerated type enum GasType gas diesel;
Create another struct I will call BodyData to hold the body style and number of doors.
This struct will be contained inside CarData. Number of doors should be an integer you
probably want to create a function to convert a string to an integer for the possible set
of numbers you will encounter
Create another struct I will call Dimensions to hold the wheel base, length, width and
height. This will also be contained inside CarData.
Create another struct I will call EngineData to hold the number of cylinders represented
as an integer the engine size, and the horsepower. This will also be contained inside
CarData.
Create another struct I will call MPG to hold both city and highway MPG
Create an array of CarData to hold all the cars.
Create a function to read the file, loading the data into your array.
Write a function for each of the statistics we wish to report, except write a single function for the MPG
data that returns both gas and diesel results. The array should be passed to each function.
Output the statistics to the console. Format it nicely so that i
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