Question: public class Chapter7Stub { public static void main(String[] args){ int[] deck = new int[52]; //Initialize deck to cards which range from 8 to 59 inclusively
public class Chapter7Stub { public static void main(String[] args){ int[] deck = new int[52]; //Initialize deck to cards which range from 8 to 59 inclusively Your code here //End of initialize block System.out.println("Initialized deck"); printDeck(deck); //Display the sum of card values between index1 and index2 // inclusively(passed in via command line arguments) int index1 = 0, index2 = 0, sum = 0; Your code here //End of display block System.out.println("Sum of card values between indexes " + index1 + " and " + index2 + " is " + sum + " "); //Shuffle deck of cards Your code here //End of shuffle System.out.println("Shuffled deck"); printDeck(deck); //Use selection sort to order the cards in deck Your code here //End of selection sort System.out.println("Sorted deck"); printDeck(deck); } public static void printDeck(int[] deck){ for (int c = 0; c < 52; c++){ System.out.printf("%3d", deck[c]); if (c % 13 == 12) System.out.println(); } System.out.println(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
