| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

LastChanceGas

Page history last edited by PBworks 16 years, 1 month ago

Al's Last Chance Gas station sits on route 190 on the edge of Death Valley. There is no other gas station for 200 miles. You are to write a program to help drivers decide if they need gas. The program asks for:

 

  • The capacity of the gas tank, in gallons
  • The indication of the gas gauge in percent (full= 100, three quarters full = 75, and so on)
  • The miles per gallon of the car.

 

The program then writes out "Get Gas" or "Safe to Proceed" depending on if the car can cross the 200 miles with the gas remaining in the tank.

 

Tank capacity:

12

Gage reading:

50

Miles per gallon:

30

Get Gas!

 

You will probably need an if or if/else statement. Here is a link to help you find more information about these loops. http://www.intap.net/~drw/cpp/cpp04_02.htm

 

 

Use AsciiArt to draw the sign, gage, gas pump, car or other graphic to make the program more visually interesting. Don't let the AsciiArt take up too much of your time. Get the program running first.

Comments (0)

You don't have permission to comment on this page.