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

  • Stop wasting time looking for files and revisions! Dokkio, a new product from the PBworks team, integrates and organizes your Drive, Dropbox, Box, Slack and Gmail files. Sign up for free.



Page history last edited by PBworks 12 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:


Gage reading:


Miles per gallon:


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.