Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Random;
  3.  
  4. public class Math {
  5. public static void main(String[] args) {
  6. Scanner in = new Scanner(System.in);
  7. Random randomGenerator = new Random();
  8. int x, t, j, f, b, c;
  9. j=0;
  10. f=0;
  11. int min = 3, max =10;
  12. System.out.println("Multiplication Test - by Hany Abboud..");
  13.  
  14. for(t=1;t<11;t+=2)
  15. while(t<11){
  16. b = randomGenerator.nextInt(max-min) + min;
  17. c = randomGenerator.nextInt(max-min) + min;
  18. t++;
  19.  
  20. System.out.println(b + "*" + c + "=");
  21. x = in.nextInt();
  22.  
  23. if (b*c==x) {
  24. j++;
  25. System.out.println("Vraie..");
  26. } else {
  27. f++;
  28. System.out.println("Faux..La Bonne Reponse Est:"+ b*c);
  29. }
  30. if (f <= 1) {
  31. if (j <= 1) {
  32. System.out.println(j+" Reponse Est Correcte!"+ j + "/10");
  33. System.out.println(f+" Reponse Est Fausse!"+ f + "/10");
  34. } else{
  35. System.out.println(j+" Reponses Sont Correctes!"+ j + "/10");
  36. System.out.println(f+" Reponse Est Fausse!"+ f + "/10");
  37. }
  38. } else {
  39. if (j <= 1) {
  40. System.out.println(j+" Reponse Est Correcte!"+ j + "/10");
  41. System.out.println(f+" Reponses Sont Fausses!"+ f + "/10");
  42. } else {
  43. System.out.println(j+" Reponses Sont Correctes!"+ j + "/10");
  44. System.out.println(f+" Reponses Sont Fausses!"+ f + "/10");
  45. }
  46. }
  47. }
  48. int T=j*2;
  49. System.out.println("Ta Note Finale Est:"+ T +"/20");
  50. if(T>=10 && T<17){
  51. System.out.println("Bravo!!");
  52. }else if(T>17){
  53. System.out.println("Exellent!!");
  54. }else if(T<10){
  55. System.out.println("Courage,tu peux faire mieux!!");
  56. }
  57.  
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement