Question: CSE 1 3 8 4 - C + + Basics Lab 2 Objectives: Practice getting input from the user Practice using loops and conditions Assignment:
CSE C Basics
Lab
Objectives:
Practice getting input from the user
Practice using loops and conditions
Assignment:
In this lab you'll be building a tool to allow people to compare their vehicles. So basically, assume a family has multiple vehicles they're able to use and they're trying to decide which vehicle would be best to use on a road trip.
Your job is to create a program that takes in how many miles their trip is supposed to be and the average gas price of their journey. You should then ask how many vehicles they'd like to compare. While looping, ask the names make and model of each vehicle and their gas mileage and tank capacity. After receiving the information, calculate how many tanks of gas it would take for each vehicle and what the projected price would be for the journey. Display this information to the user.
Your price should be based on how much it is to fill up a full tank on each individual vehicle. You shouldn't just calculate how many gallons that car would need and then calculate that cost. You also cannot have PARTIAL tanks. If it's tanks, you should display tanks and calculate it for tanks.
Finally, at the end of the program, you should display the best name cost of the car based on the calculations.
Hint:
To make into there's a couple ways to do so One such way involves the cmath library and using the ceil function.
Milestones:
You must receive a checkoff for each item to receive full credit on the lab. You may show the milestones incrementally, or receive a check off for multiple in one demo depending on your progress.
Examples of each milestone are included.
Milestone :
Receiving initial data and setting up the loop. Must show:
Distance, gas price, and number of vehicles compared
Looping the number the user entered
Your loop only has to show "car car etc for however many cars they entered at this stage
Numbering SHOULD start at not
Welcome to the mileage calculator!
How far in miles will you be traveling?
What is the average gas price for your journey?
How many cars are you comparing?
car
car
car
car
Milestone :
Accept unique data for each car. Must show:
Input for each car makemodel mpg and tank capacity
Display that information back to the user to show proper storage
How many cars are you comparing?
Enter the make and model of car : Mazda CX
Enter in the MPG miles per gallon:
Enter in the tank capacity in gallons:
Mazda CX has and a gallon capacity tank.
Enter the make and model of car : Lincoln Zephyr
Enter in the MPG miles per gallon:
Enter in the tank capacity in gallons:
Lincoln Zephyr has and a gallon capacity tank.
Milestone :
Do the math. Must show:
Proper gas tank numbers wi
How many cars are you comparing?
Enter the make and model of car : Lincoln Zephyr
Enter in the MPG miles per gallon:
Enter in the tank capacity in gallons:
Your Lincoln Zephyr will need tanks.
This will cost $
Enter the make and model of car : Mazda CX
Enter in the MPG miles per gallon:
Enter in the tank capacity in gallons:
Your Mazda CX will need tanks.
This will cost $
Milestone :
Store the makemodel and overall price of the best car for the trip to display at the end of the loop. Must show:
Correct car makemodel and price
Hint: To work, make sure you're considering localglobal scope as it applies to loops for your variables. On the very FIRST loop through, consider setting the values you're designating as the "best" to immediately be the makemodel and cost of the first car. This way, you have something to compare it to on subsequent loops.
Welcome to the mileage calculator!
How far in miles will you be traveling?
What is the average gas price for your journey?
How many cars are you comparing?
Enter the make and model of car : Mazda
Enter in the MPG miles per gallon:
Enter in the tank capacity in gallons:
Your Mazda will need tanks.
This will cost $
Enter the make and model of car : Mazda CX
Enter in the MPG miles per gallon:
Enter in the tank capacity in gallons:
Your Mazda CX will need tanks.
This will cost $
Enter the make and model of car : Lincoln Zephyr
Enter in the MPG miles per gallon:
Enter in the tank capacity in gallons:
Your Lincoln Zephyr will need tanks.
This will cost $
Your best option is the Mazda CX at $
Comment Block:
Your code should contain a comment block at the top containing information on who wrote the code, what the assignment is when it is due, etc. Here is an example of a good comment block to put:
Name: th ceiling principles applied
Correct prices
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
