Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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

Brackets problem

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im having a serious problems with my brackets (At least i think thats how you spell them.) They were perfectaly fine untill i tried to initiate lives. After that the code has all but fallen apart. I have always had a problem with brackets so if anyone could help that would be awesome. Here is the code.


Im sorry if its a bother but i need some help.
 
Kacey Simeon
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im sure someone would like to know how i fixed it. on line 380 i had to tab over that bracket, then i had to put a bracket inbetween line 379 and line 380. then i had to delete the last braket in the code. I feel stupid but whatever.
 
Marshal
Posts: 69779
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely the answer to no 20 is "he writes down, 'Can I have some sunglasses, please.'"?
I had to divide that question because lines that long make the code difficult to read. Also deleted some blank lines. So your 360 might now be 361.
But it is a disaster to have a method that long. You should have a Quiz object, and read the questions and potential answers from a text file or files.
Never say == true or similar. Not if (crowd == true) ... but if (crowd) ... If you want it false, use if (!boo) rather than if (boo == false). The reason is that == true or similar is poor style and you can get lots of errors if you mistakenly write = instead of ==.
For reasons given here, never use the tab character when writing code. (You can use \t in Strings however).
Your printouts for randomFor5050 should be put into an array, then you can say System.out.println(answersFor5050(randomFor5050));
 
I'm gonna teach you a lesson! Start by looking at 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
    Bookmark Topic Watch Topic
  • New Topic