Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Play {
- public static void main(String[] args)
- {
- int totalScore = 0;;
- System.out.println("Welcome to The Game of Odds or Evens");
- System.out.println("Instruction:");
- System.out.println("1. You will be given 2 random cards,");
- System.out.println(" named LEFT card and RIGHT card.");
- System.out.println("2. The cards are set upside down.");
- System.out.println("3. You should guess whether those two");
- System.out.println(" cards or their sum result are odd or");
- System.out.println(" even number.");
- System.out.println("4. Note that Ace is equal to 1, Jack");
- System.out.println(" is equal to 11, Queen is equal to 12,");
- System.out.println(" and King is equal to 13.");
- System.out.println("5. Guessing score details: ");
- System.out.println(" Left card only, true = 3 pts, false = -1 pts.");
- System.out.println(" Right card only, true = 3 pts, false = -1 pts.");
- System.out.println(" Left and right card, true = 8 pts, false = -4 pts.");
- System.out.println(" Addition of both cards, true = 6 pts, false = -3 pts.\n");
- System.out.println("Want to start the game?");
- System.out.println("Insert y (yes) or n (no)");
- int t = 0;
- while( t == 0)
- {
- Scanner sc = new Scanner(System.in);
- char yn = sc.next().charAt(0);
- if (yn == 'y')
- {
- t = 1;
- Game g = new Game();
- totalScore= totalScore + (g.check());
- int t2 = 0;
- while(t2 == 0)
- {
- System.out.println("\nContiune Playing?");
- System.out.println("Insert y (yes) or n (no)");
- char yn2 = sc.next().charAt(0);
- if (yn2 == 'y')
- {
- Game gg = new Game();
- totalScore= totalScore + (gg.check());
- }
- else if (yn2 == 'n')
- {
- t2 = 1;
- System.out.println("Your score accumulation: " +totalScore);
- System.out.println("Thanks for Playing");
- }
- else
- {
- System.out.println("\nPlease insert y or n only.");
- }
- }
- }
- else if (yn == 'n')
- {
- t = 1;
- System.out.println("~See You~");
- }
- else
- {
- System.out.println("\nPlease insert y or n only.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement