Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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: 8104
571
Mac OS X VI Editor BSD Linux
  • 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: 8104
571
Mac OS X VI Editor BSD Linux
  • 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: 74359
334
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic