New to java I need help with switch case error

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2007
Posts: 2
Reputation: champagne is an unknown quantity at this point 
Solved Threads: 0
champagne champagne is offline Offline
Newbie Poster

New to java I need help with switch case error

 
0
  #1
Sep 30th, 2007
I am new to Java and can not figure out why I am getting this error for swithc case.
Attached Files
File Type: java ConvertTemp05.java (2.3 KB, 5 views)
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: New to java I need help with switch case error

 
0
  #2
Sep 30th, 2007
1) Please post your code here.
2) Make sure you indent your code properly
3) Use [code][/code] tags
4) Post what error messages you get.
Last edited by iamthwee; Sep 30th, 2007 at 7:30 am.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1
Reputation: venkatev is an unknown quantity at this point 
Solved Threads: 0
venkatev venkatev is offline Offline
Newbie Poster

Re: New to java I need help with switch case error

 
0
  #3
Sep 30th, 2007
Not sure what problem you are facing... but one obvious thing i spotted is that you are having a statement after the break; You might have got 'Unreachable code' error. If that's not your issue, could you elaborate on your problem? Also, could you please correct indentation?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,197
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 485
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: New to java I need help with switch case error

 
0
  #4
Sep 30th, 2007
You have two curly bracklets on start of switch statement and only one on closing
  1. switch (sCode){
  2. {
  3. case 'c':
  4. case 'C':
so delete one.
However once this done there is another 13 error messages which you need to sort. GL
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 2
Reputation: champagne is an unknown quantity at this point 
Solved Threads: 0
champagne champagne is offline Offline
Newbie Poster

Re: New to java I need help with switch case error

 
0
  #5
Sep 30th, 2007
Originally Posted by champagne View Post
I am new to Java and can not figure out why I am getting this error for swithc case.
I did correct the errors but I can not get the input message for Fahrenheit to show ConvertTemp05 in the heading box. and the 'c' to show. It only shows c. I have attached the correct code

Thanks a bunch
Attached Files
File Type: java ConvertTemp05.java (2.3 KB, 6 views)
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 164
Reputation: orko is an unknown quantity at this point 
Solved Threads: 10
orko orko is offline Offline
Junior Poster

Re: New to java I need help with switch case error

 
0
  #6
Oct 2nd, 2007
The code you have given have following problems:
1. There is no java object type called "character". Might be you wanted "Character".
2. You have not defined what is "input" variable on line 28.
3. You have not defined "temp", "cel", "df" before you used them. You can not initiate them whenever you want. (Happened for "df")
4. This whole line has formatting error:
  1. JOptionPane.showMessageDialog(null, (cel + " degrees in Celsius is " + df.format (f) + " degrees in Fahrenheit." "ConvertTemp05");
5. What is "fht"?????????????
Please fix these problems first, the program should work. (I am wondering how did you get any kind of output.. the code should not compile even)... Good luck..
A Perfect World
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC