Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Methods and Class interactions

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Marshal
Posts: 76487
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Trust God, but always tether your camel... to this tiny ad.
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic