Question: Please help me with this C++ program. Your program Assignment Write a program named TankOfGas. The program will have the use input into a variable
Your program Assignment Write a program named TankOfGas. The program will have the use input into a variable the number of gallons of gas in the gas tank, the miles per gallon in town and the miles per gallon on the highway (Optionally: you can also have the use input MPG for highway and town). Have the program calculate the number of miles traveled in town and on the highway. Display the result on the screen. Default MPG could be 23.5 miles in town and 28.9 miles on the highway Calculate both miles in dty and on the highway. Hint: Distance- Number of Gallons X Average Miles per Gallon Sample of output: My car has a 20 gallon tank of gas and gets 21.5 niles per gallon in town and 26.8 niles per gallon on the highway. This neans that ny car can drive a total of: 138 niles in toun and 536 niles on the highway. Do you uant to You need to know infornat ion for your car to see your totala? big your tank is. your nileage in toun, and on the highway Enter info for your car? y> low nany gallons of gas does your car ho la? 18 low nany niles to the gallon do you get in toun? 21.5 low nany niles to the gallon do you get on the higway? 28.9 Your car wich a 18 gallon tank can drive 387 niles in town. ohi highwny Nou you know.. k. well have a nice dayt Press any key to cont inue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
