Nguyen_BlackJack.docx - \/BlackJackClass package [email protected] scottnguyen public class [email protected] args the command line arguments

Nguyen_BlackJack.docx - /BlackJackClass package...

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

//BlackJackClasspackage blackjackclass;/**** @author scottnguyen*/public class BlackJackClass {/*** @param args the command line arguments*/public static void main(String[] args) {Player player = new Player();Player dealer = new Player();}}//Deckpackage blackjackclass;import java.util.*;/**** @author scottnguyen*/public class Deck {//Card[] deck;ArrayList<Card> deck;int top;//Array or ArrayList either is finepublic Deck(){deck = new ArrayList<Card>(52);top = 0;String[] ranks = {"Ace","King","Queen","Jack","10","9","8","7","6","5","4","3","2"};
Background image
String[] suits ={"Hearts","Spades","Diamonds","Clubs"};int[] values ={11,10,10,10,10,9,8,7,6,5,4,3,2};for(int i=0; i<deck.size(); i++){//deck[i] = new Card(ranks[i%13], suits[i%4], values[i%13]); // assigns all values of deck.add(new Card(ranks[i%13], suits[i%4], values[i%13]));}}Random rand = new Random();for(i = 0; i > n; i++;){Int r = i + randNextInt <= 52;}Int temp = card [r];card [r] = card [i];card [i] = int temp;//shuffle methodPublic static void main(String []args){shuffle.arr (r,52);}for (i=0; i < 52; i++){card1= int r;card2=int r2;System.out.print(card1 + card2); //the player gets two cards with different values}//deal a card }//Cardpackage blackjackclass;/**
Background image
*
Background image
Image of page 4

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture