Question: Create a C + + program that contains the following functions: a . void displayCarDetails ( string [ ] , double [ ] , int
Create a C program that contains the following functions:
a void displayCarDetailsstring double int: This function takes two parallel arrays cars and mpg and their size as input. It displays the car details, including car name, MPG and whether it is "Economical" or a "Gas Guzzler" based on its MPG value.
Prepopulate two parallel arrays with elements each:
a cars: This string array will hold the names of cars eg "Car A "Car B etc.
b mpg: This double array will hold the MPG values of the corresponding cars.
Use the displayCarDetails function to output the car details.
The program should calculate whether a car is "Economical" or a "Gas Guzzler" based on the following rule:
If the MPG is greater than the car is considered "Economical."
Otherwise, the car is considered a "Gas Guzzler."
add a function that returns the average mpg of all cars
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
