Question: C# using Visual Studio You are planning to buy a vehicle and need an app to compare the time, fuel consumption, and cost for a

C# using Visual Studio
You are planning to buy a vehicle and need an app to compare the time, fuel consumption, and cost for a 60-mile commute. The app uses the following class hierarchy to represent your vehicular options: Bicycle, Auto, or PHEV (plug-in hybrid).
All options have a name (Name), an average speed (Speed) in miles per hour, the number of miles travelled (Miles), and the required time in hours (Hours). Hours is always Miles/Speed.
The auto option (Auto) uses fuel (Gallons) with an average fuel consumption (MPG) and fuel cost (Cost). Assuming a fuel price of $4.00 per gallon, the fuel cost is: Gallons * $4.00. The gallons of fuel consumed (Gallons) is Miles / MPG. The Auto constructor has three parameters: Name, Miles and MPG. Assume your average speed by auto is 65 mph.
A PHEV is a plug-in hybrid auto that switches to gas when battery power runs out. Gallons of fuel is determined by first subtracting the battery range (Range) from the miles driven: (Miles Range)/ Mpg. The PHEV constructor has an additional parameter for the battery range.
The bicycle option is more economical but slower. Assume a cyclist bikes an average speed of 2000 divided by their weight (Weight), so speed is: 2000/Weight. A bicycle doesnt have Cost because it is not an auto and uses no fuel. The Bicycle constructor has three parameters: Name, Miles, and Weight.
No methods are needed for this hierarchy.
Now, create a collection of vehicles that includes a bicycle, an auto, and a PHEV, for a 60-mile commute. The cyclist weights 150 lbs. The auto (a Cadillac) gets 20 mpg. The PHEV (a Chevy Volt) gets 40 mpg with a range of 39 miles. Use a single loop to display the Hours, Gallons, and Cost of each vehicular option. If the vehicle is not an auto, omit Gallons and Cost from the output, as shown. You are planning to buy a vehicle and need an app to compare the time, fuel consumption, and cost for a 60-mile commute. The app uses the following class hierarchy to represent your vehicular options: Bicycle, Auto, or PHEV (plug-in hybrid).
Vehicle Hierarchy
All options have a name (Name), an average speed (Speed) in miles per hour, the number of miles travelled (Miles), and the required time in hours (Hours). Hours is always Miles/Speed.
The auto option (Auto) uses fuel (Gallons) with an average fuel consumption (MPG) and fuel cost (Cost). Assuming a fuel price of \(\$ 4.00\) per gallon, the fuel cost is: Gallons *\(\$ 4.00\). The gallons of fuel consumed (Gallons) is Miles / MPG. The Auto constructor has three parameters: Name, Miles and MPG. Assume your average speed by auto is 65 mph .
A PHEV is a plug-in hybrid auto that switches to gas when battery power runs out. Gallons of fuel is determined by first subtracting the battery range (Range) from the miles driven: (Miles - Range)/ Mpg. The PHEV constructor has an additional parameter for the battery range.
The bicycle option is more economical but slower. Assume a cyclist bikes an average speed of 2000 divided by their weight (Weight), so speed is: \(2000/\) Weight. A bicycle doesn't have Cost because it is not an auto and uses no fuel. The Bicycle constructor has three parameters: Name, Miles, and Weight.
No methods are needed for this hierarchy.
Now, create a collection of vehicles that includes a bicycle, an auto, and a PHEV, for a 60-mile commute. The cyclist weights 150 lbs . The auto (a Cadillac) gets 20 mpg . The PHEV (a Chevy Volt) gets 40 mpg with a range of 39 miles. Use a single loop to display the Hours, Gallons, and Cost of each vehicular option. If the vehicle is not an auto, omit Gallons and Cost from the output, as shown.
C# using Visual Studio You are planning to buy a

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 Programming Questions!