• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Homwork help, cant seem to find the mistake.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
// The program will print out whether a number is even or odd. The number to be checked is in variable numbers. The variable number is declared as an int.

 
Marshal
Posts: 8857
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Check how to UseCodeTags (<- link to click) when you post your code. It is important. I have added them for you this time.

Your code is badly indented. Missing curly braces, as well as semi colons at the end of statements. Fix them first and see what other problems you're facing.
 
Ranch Hand
Posts: 58
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A few issues straight off:

You've misspelled "scanner" in your import statement.
You're not using any of the variables you declare.
You're using a variable you don't declare (tall).
You're trying to break out of a loop using a label, but you haven't created the label. You're not actually in a loop, though, so there's no need to break here.
 
Liutauras Vilda
Marshal
Posts: 8857
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. There is a class "Scanner", not "scaner" and each statement end with semicolon.
2. Class declaration with correctly indented code should look like:
More about switch statement (<- link).

3. How to use Scanner (<- link).
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I should be very surprised if that code compiles.
Don't use labelled break.
Please go back to your code and correct the compiler errors (e.g. add a { after class name) and indent it properly.
Then post the code again, using copy‑and‑paste.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic