Question
I am making the riddle game, there are 10 math questions on it but I need to change a bit the code, I would like
I am making the riddle game, there are 10 math questions on it but I need to change a bit the code, I would like the players will get $ 100 awards for each right questions, so I need help to do that
HERE IS MY CODE :
public class Question{ String level; String answer; public Question (String level, String answer) { this.level = level; this.answer = answer; } }
ANOTHER CLASS
import java.util.Scanner; public class WhoisaMillionaire { public static void main(String [] args){ String q1 = "1) What type of conic section does this equation represent? 4x^2+15y^2+343=0 " + "(a)Ellipse (b)Parabola (c)Hyperbola (d)Circle"; String q2 = "2) What is the center and radius of the circle indicated by the equation? (x2)2+y2=36 " + "(a)(2,0), r=6/= (b)(2,0), r=36 (c)(2,0), r=36 (d)(2,0), r=6"; String q3 = "3) Find the vertex (x,y) for a parabola with equation: y=3x^26x+1 " + "(a)(1,3) (b) (1,2) (c) (1,1) (d)(1,2) (e)(2,1)"; String q4 = "4) What is the minimal value of 2x^2+16x7 over all real numbers? " + "(a)2 (b)-10 (c)-39 (d)No minimum value."; String q5 = "5) What is log2(8)? " + "(a)-3 (b)-4 (c)3 (d)1/8 (e)4"; String q6 = "6) Solve for x: log2(x+4)+log2(x+5)=log26 " + "(a)x=4 or x=128 (b)x=7 or x=2 (c)x=2 or x=7 (d)The correct solution set is not included among the other choices."; String q7 = "7) The fourth term in an arithmetic sequence is -20, and the eighth term is -10. What is the hundredth term in the sequence? " + "(a)105 (b)110 (c)55 (d)220"; String q8 = "8) What is the sixth term when (1/2x2)^10 is expanded? " + "(a)840x^6 (b)840x^5 (c)840x^6 (d)252x^5 (e)252x^5"; String q9 = "9) Find the sum of all even integers from 250 to 350. " + "(a)15,000 (b)15,300 (c)14,000 (d)14,500 "; String q10 = "10) The speed of a car traveling on the highway is given by the following function of time: v(t)=5t2+2t What can you say about the car's speed after a long time (that is, as t approaches infinity)? " + "(a)The speed of the car approaches infinity. (b)The speed of the car approaches a constant number. (c)Nothing can be concluded from the given function. (d)The speed of the car approaches zero."; Question [] questions = { new Question(q1, "c"), new Question(q2, "a"), new Question(q3, "d"), new Question(q4, "c"), new Question(q5, "c"), new Question(q6, "d"), new Question(q7, "d"), new Question(q8, "e"), new Question(q9, "a"), new Question(q10, "a") }; takeAGuess(questions); } public static void takeAGuess(Question [] questions){ int point = 0; Scanner keyboardInput = new Scanner(System.in); for(int i = 0; i < questions.length; i++){ System.out.println(questions[i].level); String answer = keyboardInput.nextLine(); if (answer.equals(questions[i].answer)){ point++; } } System.out.println("OMG, You earned" + point + "/" + questions.length); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To modify the game so that the players receive 100 for each correct answer you can update the takeAG...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started