vendredi 6 mars 2015

JAVA: Convert a string to int, and then perform if statement around the number



I could use some help with this thought process.


Here is what I am working on.


I have a boolean method that is to take a string, convert it to a number, and then perform if statements. to make them true once they pass through it.


It's a category based system. Here is the code in Pseudocode. To give you an idea, the fuel type as a string is E0 to E100.



Category 1 = E0 - E10

Category 2 = E11 - E25

Category 3 = E26 - E84

Category 4 = E85 - E100



if (CHECK TO SEE IF THE TYPE OF FUEL IS IN CATEGORY "E")
{
if (fuelType.length == 4 THIS IS E100 && fuelType.length == 3 THIS IS 10-99)
if (fuel <= 100 && fuel >= 85)
return true


ETC. Hopefully this is enough information for you to give me a hand. If not, I can continue

}




Aucun commentaire:

Enregistrer un commentaire