By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,034 Members | 822 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,034 IT Pros & Developers. It's quick & easy.

Math

P: 5
Hi All
very new to programing so please excuse me

how would you create a math game in JAVA

say 5 questions

Thanks
Nov 23 '06 #1
Share this Question
Share on Google+
8 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
Hi All
very new to programing so please excuse me

how would you create a math game in JAVA

say 5 questions

Thanks
What type of game are you wanting to make? Counting, guessing, etc...? Need more info to help.
Nov 24 '06 #2

P: 5
Hi Sorry

One which asks pre set questions the user then inputs what they think is the answer and the computer ten provides a
right or wrong answer
Nov 24 '06 #3

sicarie
Expert Mod 2.5K+
P: 4,677
Hi Sorry

One which asks pre set questions the user then inputs what they think is the answer and the computer ten provides a
right or wrong answer
What is your level of programming skill? I mean, quickly, I would just say:

Output a question,
read in the answer
check the answer

and repeat five times.

This can differ in complexity as much as you want it to - from selecting questions randomly from a file or database so there is less repetition and comparing against strings of answers and keywords - to asking the same five questions, looking for numerical input for the easiest checking.

It sounds like you need to create a better concept of how you want this game to be played (and then fit that to whatever timeline you need the program done by).
Nov 24 '06 #4

P: 5
Output a question,
read in the answer
check the answer

Exactly that,

My level of programing Lower than novice im afraid, Just started but having a bad time with it

Thanks
Nov 27 '06 #5

sicarie
Expert Mod 2.5K+
P: 4,677
Output a question,
read in the answer
check the answer

Exactly that,

My level of programing Lower than novice im afraid, Just started but having a bad time with it

Thanks
cout your question
cin your answer
check the answer (if statement)
repeat 5 times

If you're not sure what cout and cin means, check out thescripts' C++ tutorial:

http://www.thescripts.com/serverside...ops/index.html
Nov 27 '06 #6

10K+
P: 13,264
cout your question
cin your answer
check the answer (if statement)
repeat 5 times

If you're not sure what cout and cin means, check out thescripts' C++ tutorial:

http://www.thescripts.com/serverside...ops/index.html
I thought this was a java question. An interesting question I'd have to say.
Nov 28 '06 #7

sicarie
Expert Mod 2.5K+
P: 4,677
I thought this was a java question. An interesting question I'd have to say.
That would present a slight problem, wouldn't it? Sorry, forgot which forum I was in :( .

Here's Sun's Java tutorial....

http://java.sun.com/docs/books/tutorial/
Nov 28 '06 #8

10K+
P: 13,264
Output a question,
read in the answer
check the answer

Exactly that,

My level of programing Lower than novice im afraid, Just started but having a bad time with it

Thanks
If you are a novice, then use a switch together with Math.random().
Here is the framework
Expand|Select|Wrap|Line Numbers
  1.  while(user still wants to answer) { 
  2.  
  3.          int choice = (int)(Math.random()*5);
    switch(chioce) {
  4.    case 1: {
  5.       logic of question 1
  6.      ask if user still wants to answer
  7.    }
  8.    case n: {
  9.       logic of question n
  10.      ask if user still wants to answer
  11.    }
  12. }
  13. }
  14.  
  15.  
Should be interesting to try out this first before you try to mess it up a little.
Nov 28 '06 #9

Post your reply

Sign in to post your reply or Sign up for a free account.