Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

help with project please

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been working on this project for a while now and i'm totally stumped. Can't figure out how to fix these errors and i'm sure some are simple to fix but I think i'm so frustrated i'm just overlooking them.
I'm trying to create a grid for each board game and setting the cells. Any suggestions would be great!







 
Sheriff
Posts: 15815
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

If you need help resolving errors, it would help others help you if you TellTheDetails (←click that, it's a link). Specifically, what are the errors you're getting. Paste the exact error messages you're seeing.
 
Junilu Lacar
Sheriff
Posts: 15815
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code formatting doesn't help either. If you're using an IDE like Eclipse, you can easily format your code in a standard way. In Eclipse, the keyboard shortcut is Ctrl+Shift+F (or Cmd+Shift+F on Mac). This way, you can see how the opening and closing braces match and the structure and organization of your code can be more easily discerned.  Right now, it's confusing to read the way you posted it.
 
Junilu Lacar
Sheriff
Posts: 15815
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing that jumps out immediately is your use of the EMPTY symbolic name which doesn't appear to be declared anywhere in this class. A name needs to be defined and in scope where you use it, otherwise, you'll get a "Symbol not found" compilation error.
 
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code that you posted has multiple errors.  The first error is poor formatting.  Yes, that's an error.  To prove it to yourself, format your code correctly and you will find that your braces are mismatched.

Another error is leaving off braces around things like if statements and for loops.  Yes, it's allowed and yes, it's still an error.  Try putting the braces back and you will likely find an empty for loop.
 
Jen Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I believe I've fixed it up a bit and i tried and cleaned it up and format it better. Still getting some errors though. Lines 23, 25, 42, 44, 55, 57, 59, 61, 63 are all giving me the "cannot find symbol error". They are all where I am trying to set the cells to the colors in the mastermind and connect four board games and in the tictactoe board game, setting the cells to a NOUGHT and CROSS. Also on line 69 its giving me the "cannot find symbol error". That's where i'm trying to display the boards. Sorry if this seems a bit confusing I am super new at this. Thank you guys for your suggestions so far!





 
Sheriff
Posts: 7660
522
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a note seriously.

1. You have been given multiple advices, Knute specifically mentioned what is wrong, he pointed out 2 serious roots of issues - none of them you fixed (ignored basically).
2. Junilu mentioned about the formatting and indentation - it is still all over the place too (ignored).

There is no point in pointing out further issues as it seems you can't cope with 2 or 3 of them at hand.

Was it you who wrote that code?
 
Junilu Lacar
Sheriff
Posts: 15815
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please format/indent your code properly. If you're using Eclipse, just press Ctrl+Shift+F.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the things that is wrong with your code is the semi-colon at the end of line 51:

This makes the code do something entirely different than you think it does. What the line now means is: "loop starting with c = 0, as long as c less than 8, increment c at each iteration, and in each iteration: do nothing". The ; is an empty "do nothing" statement.

The block between { ... } that follows is executed exactly once, after the loop has done nothing 8 times. Because of the ; the block { ... } is no longer the body of the loop - the ; is the body of the loop.

It's very important to be very precise and pay attention to all the details when you write a program - because the computer does exactly what you tell it to do. That's also why the others are urging you to write and format your code properly, because that makes it much easier to see the structure of the program.
 
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic