Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java HomeWork8

eltom117
eltom117 


-Use the same textbook we used previously. -No need for the extra credit option. -Attached the questions + Starter file with hints. Attachments Tags Clarifications

Answers

Assignment 8 - Solution

dickersonka
dickersonka 



Attached is the solution to assignment 8 including source and comments. Attachments
Assignment8.zip (12 K) Download
Preview
to initialize Card public Card( String f, String s ) { face = f; suit = s; } // get suit protected

Preview
/ (double)GAMES ) + " rolls." ); TextIO.putln( "Chancing of winning is roughly the same and does not improve past the first roll" ); } // end method main // rolls dice, returns sum of dice rolls public static int rollDice() {

Preview
( Math.random() * deck.length ); Card temp = deck[ first]; deck[ first] = deck[ second ]; deck[ second ] = temp; } } public Card dealCard() { if ( currentCard < deck.length ) return deck[ currentCard++ ]; else

Preview
args){ //create array to hold results up to #12 int sums[] = new int[13]; Random rand = new Random(); //loop 36 million times for( int i = 0; i < 3600000;

Preview
{ output += ( "Three " + DeckOfCards.faces[ k ] + "'s" ); triples++; break; } } // determine if hand contains a four of a kind public void fourOfAKind() { for ( int k = 0; k < DeckOfCards.faces.length;

Preview
cases, an * IllegalArgumentException will be thrown if a legal value is not found. */ public static long getLong() { return readInteger(Long.MIN_VALUE, Long.MAX_VALUE); } /** * Skips whitespace characters and then reads a single non-whitespace * character from input. Any

Screenshots
Purchase Answer