import java.docx - import java.util.Random public class Card cfw private static Random generator = new Random private int suit num private String

import java.docx - import java.util.Random public class...

This preview shows page 1 - 2 out of 2 pages.

import java.util.Random; public class Card { private static Random generator = new Random(); private int suit , num ; private String cardSuit , cardNum ; //----------------------------------------------------------------- // Sets up the Card by choosing a random card. //----------------------------------------------------------------- public Card () { shuffle(); } //----------------------------------------------------------------- // Chooses the card by randomly choosing a suit and number. //----------------------------------------------------------------- public void shuffle() { num = generator .nextInt(13) +1; suit = generator .nextInt(4) +1; } //----------------------------------------------------------------- // Returns your current card. //----------------------------------------------------------------- public String toString() { if ( num >=2 && num <= 10) cardNum
Image of page 1
Image of page 2

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture