• Post Reply Bookmark Topic Watch Topic
  • New Topic

Homwork help, cant seem to find the mistake.  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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.

 
Sheriff
Posts: 4931
334
BSD
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Posts: 4931
334
BSD
  • Mark post as helpful
  • send pies
  • 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: 56600
172
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!