Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3.  
  4. public class MathGame {
  5.  
  6. private int operand1;
  7. private int operand2;
  8. private int solution;
  9.  
  10. public MathGame (int operand1, int operand2)
  11. {
  12. this.operand1 = operand1;
  13. this.operand2 = operand2;
  14. }
  15.  
  16. public int genRandom1()
  17. {
  18. Random rand = new Random();
  19. int randNum = rand.nextInt(0) + 20;
  20. randNum = operand1;
  21. return operand1;
  22. }
  23.  
  24. public int genRandom2()
  25. {
  26. Random rand = new Random();
  27. int randNum2 = rand.nextInt(0) + 20;
  28. randNum2 = operand2;
  29. return operand2;
  30. }
  31.  
  32. public int getoperand1()
  33. {
  34. return operand1;
  35. }
  36.  
  37. public int getoperand2()
  38. {
  39. return operand2;
  40. }
  41.  
  42. public String question()
  43. {
  44. return "What is" + operand1 + operand2 + "?";
  45. }
  46.  
  47. public String solution()
  48. {
  49. int solution = operand1 + operand2;
  50. return "The correct answer is: " + solution;
  51. }
  52.  
  53. }
  54.  
  55. import java.util.Scanner;
  56.  
  57.  
  58. public class MathGameMain {
  59.  
  60. public static void main(String[] args) {
  61.  
  62. Scanner scan = new Scanner(System.in);
  63.  
  64. MathGame game1 = new MathGame();
  65.  
  66. }
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement