• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

reyhanzo Dec 17th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import java.util.Scanner;
2.
3. public class Play {
4.
5.     public static void main(String[] args)
6.     {
7.         int totalScore = 0;;
8.         System.out.println("Welcome to The Game of Odds or Evens");
9.             System.out.println("Instruction:");
10.             System.out.println("1. You will be given 2 random cards,");
11.             System.out.println("   named LEFT card and RIGHT card.");
12.             System.out.println("2. The cards are set upside down.");
13.             System.out.println("3. You should guess whether those two");
14.             System.out.println("   cards or their sum result are odd or");
15.             System.out.println("   even number.");
16.             System.out.println("4. Note that Ace is equal to 1, Jack");
17.             System.out.println("   is equal to 11, Queen is equal to 12,");
18.             System.out.println("   and King is equal to 13.");
19.             System.out.println("5. Guessing score details: ");
20.             System.out.println("   Left card only, true = 3 pts, false = -1 pts.");
21.             System.out.println("   Right card only, true = 3 pts, false = -1 pts.");
22.             System.out.println("   Left and right card, true = 8 pts, false = -4 pts.");
23.             System.out.println("   Addition of both cards, true = 6 pts, false = -3 pts.\n");
24.             System.out.println("Want to start the game?");
25.             System.out.println("Insert y (yes) or n (no)");
26.             int t = 0;
27.             while( t == 0)
28.             {
29.                 Scanner sc = new Scanner(System.in);
30.                 char yn = sc.next().charAt(0);
31.                 if (yn == 'y')
32.                 {
33.                     t = 1;
34.                     Game g = new Game();
35.                     totalScore= totalScore + (g.check());
36.                     int t2 = 0;
37.                 while(t2 == 0)
38.                 {
39.                         System.out.println("\nContiune Playing?");
40.                         System.out.println("Insert y (yes) or n (no)");
41.                         char yn2 = sc.next().charAt(0);
42.                         if (yn2 == 'y')
43.                         {
44.                             Game gg = new Game();
45.                             totalScore= totalScore + (gg.check());
46.                         }
47.                         else if (yn2 == 'n')
48.                         {
49.                             t2 = 1;
50.                             System.out.println("Your score accumulation: " +totalScore);
51.                             System.out.println("Thanks for Playing");
52.                         }
53.                         else
54.                         {
55.                             System.out.println("\nPlease insert y or n only.");
56.                         }
57.                     }
58.                 }
59.                 else if (yn == 'n')
60.                 {
61.                     t = 1;
62.                     System.out.println("~See You~");
63.                 }
64.                 else
65.                 {
66.                     System.out.println("\nPlease insert y or n only.");
67.                 }
68.         }
69.     }
70. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top