• Post Reply Bookmark Topic Watch Topic
  • New Topic

Methods and Class interactions  RSS feed

 
Daniel Castellano
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I'm new to the forum and programming in general. Currently on week 9 of Java lessons and i've been told to made a "game" for week 15, and i picked some sort of Quiz Up clone.

The thing is i'm not sure about one thing, for example i have a class called Question and another class called Time. So basically whenever the user picks a wrong answer, the question is passed and -5 seconds of the total time are substracted. If the user picks the correct answer then +5 seconds are added to the total time.

I have my question class with a method to check the answers and but i haven't done the time thing in the Time class because i don't know how to connect the choices made my the user in Question class to a method that adds and substract seconds in another class.

 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that you only have the parts and you have to look at the whole. You need a plan, either on screen or on paper or in your head.

Consider a quiz. Remember how it works. You ask competitors questions and they get marks (or otherwise) for answers. You appear to have classes for the questions and the time, but do you have classes for the whole quiz or the competitors?
 
Daniel Castellano
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:The problem is that you only have the parts and you have to look at the whole. You need a plan, either on screen or on paper or in your head.

Consider a quiz. Remember how it works. You ask competitors questions and they get marks (or otherwise) for answers. You appear to have classes for the questions and the time, but do you have classes for the whole quiz or the competitors?


Oh yes, the Question class involves both, questions and answers. Besides the time there is the Frame time for everything related to the interface of the game(however i'm testing it on the console itself). I have a Level class that will check the advance of the player(5 questions each level) and finally the User class.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!