program4.java - Tan Dao program 4 csc 205 Card Hand and Deck Implementation import java.util.Scanner import java.util import java.util.Random public

program4.java - Tan Dao program 4 csc 205 Card Hand and...

This preview shows page 1 - 4 out of 11 pages.

// Tan Dao // program 4 // csc 205// Card, Hand, and Deck Implementationimport java.util.Scanner;import java.util.*;import java.util.Random;public class program4{private static Scanner toan; public static void main (String[] args){toan = new Scanner(System.in);char again;int option;Hello(); card test = new card (3,1);System.out.println(test);do{System.out.println("\n");Option();System.out.println("Enter your option: ");option=toan.nextInt();while (option <1 && option >3){System.out.println("Please enter option from 1 to 3.");option = toan.nextInt(); }if (option == 1){TestTheDeckHand();}else if (option == 2){goFish();}HoldScreen();}while (option !=3); Goodbey();}
Background image
public static void Option(){System.out.println("Please chose the following option! ");System.out.println(" (1) Test The Deck Hand. ");System.out.println(" (2) Play "+" Go Fist "+" ! "); System.out.println(" (3) Quit !");}/**public void displayDeck(){for (Card3 card3: deck3)System.out.println(card3);}**/public static void Hello(){ System.out.println(" Card,Hand,andDeck Implementation ");System.out.println(" This is a program play card");System.out.println(" Game Go First !");}public static void HoldScreen(){String hold;System.out.println("\nType any character and press enter to continue: ");hold=toan.next();}public static void Goodbey (){System.out.println("\n Have a nice day ! \n");}public static void Gofist(){System.out.println(" ttest option 3 !");}public static DeckHand createDeck(DeckHand deck){for(int i=1;i<=4;++i){for (int ii =1;ii<=13;ii++){deck.insert(new card(i,ii));}}return deck;}public static void TestTheDeckHand(){DeckHand Hand=new DeckHand();DeckHand Deck=new DeckHand();DeckHand handChoice=new DeckHand();char again='y';char choice;char selectHand=' ';Deck= createDeck(Deck);
Background image
System.out.println("This program can organize the deck or your hand card.\n");do{System.out.println("Please choise what option you want to do. \n");System.out.println("a) Reset the hand to empty.");System.out.println("b) Insert a card.");System.out.println("c) Delete a chosen card");System.out.println("d) Delete a random card");System.out.println("e) Count how many of value with same suit.");System.out.println("f) Count how many of card !");System.out.println("g) Display the entire card.");System.out.println("h) Quit!");choice = toan.next().charAt(0);if (choice != 'h'){again ='y';System.out.println("Which would you like to use hand or deck ?");System.out.println("h) Hand");
Background image
Image of page 4

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture