This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm very new to Java (and programming in general) and am working on a series of tutorials.
The problem is...I'm not so good at the math parts. If anyone could just point me in the right direction on how to solve this problem, it would be greatly appreciated.
---Taken from the tutorial---
Exercise 3 --- Last Chance Gas 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!
Use integers for all input and all arithmetic.
This is what I've come up with so far:
I have to use only integers for the arithmetic and can only use if-else statements.
Thank You, [ May 08, 2008: Message edited by: Tod Novak ]
"-Of all the things I've lost...I miss my mind the most!"