I am making the riddle game like there are some math questions and the player will get
Question:
I am making the riddle game like there are some math questions and the player will get $100 for each right answer. But I need help to make this game more advanced, so I think I really help to add some music when the players get all the right questions. Besides, I need help to make a class that represents a shop to allow the players will purchase their items such as cars, rings, gold, or scented candles as they earn money after getting any right questions.
HERE IS MY MAIN 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; int amountEarned = 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++; amountEarned += 100; } } System.out.println("OMG, You earned" + point + "/" + questions.length); System.out.println ("And you accumlated a total of $" + amountEarned + "!"); } }
AND ANOTHER CLASS: public class Question{ String level; String answer; public Question (String level, String answer) { this.level = level; this.answer = answer; } }
Fundamentals of Case Management Practice Skills for the Human Services
ISBN: 978-1305094765
5th edition
Authors: Nancy Summers