[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
A switch code problem  XML
Forum Index » New to Java
Author Message
NewOrder

Newbie

Joined: 06/22/2010 05:04:50
Messages: 7
Offline






the instruction to this code is to make the user write numbers from 1-100 and the application should categorize the numbers in the following way



100 - A
90-99 - B
80-89 - C
70-79 - D
60-69 - E
other - F


the problem is with the other. it should go from 59 to 0.

however, the application categorizes any number as "others"

how can i cause the application to accept numbers from 0-100 and not accept numbers higher than 100?


you cant use the if or while method. or any other fancy method

This message was edited 1 time. Last update was at 06/26/2010 09:12:37

stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 849
Location: Superior, CO, USA
Offline

If you can only use switch then your only option is:



and so on. Normally with an if statement you'd do something like:


Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
 
Forum Index » New to Java
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle