Using Java design a program that creates an array of Card objects, shuffles them, then sorts them
Question:
Using Java design a program that creates an array of Card objects, shuffles them, then sorts them in the following ways: 1. By value 2. By suit and value You'll need to implement two different iterative sorting algorithms for each type of sort. For example, you could use a bubble sort to sort by value and an insertion sort to sort by suit and value. Your Card class must contain the following two fields: value (a String) suit (a String) You may include any additional fields, constructors, or methods in your Card class as you see fit for your design. Your array will need to contain 52 Card objects, one for each value of each suit. The values to use are 2 through 10, J, Q, K, and A, with A being the card with the highest value. The suit values to use are H (for Hearts), D (for Diamonds), C (for Clubs), and S (for Spades). After building the array, shuffle the array using the Fisher-Yates Algorithm. You must implement this algorithm yourself. After shuffling, print each object's value and suit to show the array was shuffled. The output for each object printed should be VALUE - SUIT. For example: 2 - H or Q - C Then, you'll need to sort the array based on the values. All 2 cards should be at the beginning and all A cards should be at the end; The suit is irrelevant here. After sorting, print each object's value and suit again to show the array was sorted based on the cards' values. Finally, you'll sort the same array based on the suit and value. Clubs should be first, then Diamonds, then Hearts, then Spades. Each suit should be sorted from 2 through A. After sorting, print each object's value and suit again to show the array was sorted based on the cards' values and suits.
Sample Output For brevity, the below example output below only uses cards 9 through A Unsorted array of Card objects: J - D Q - H 9 - C K - S 10 - H 10 - C J - C J - H Q - S A - H K - C Q - D A - S 9 - S A - C 9 - D 10 - D J - S A - D K - H 9 - H K - D 10 - S Q - C Sorted by value: 9 - H 9 - C 9 - S 9 - D 10 - C 10 - H 10 - S 10 - D J - C J - S J - H J - D Q - H Q - S Q - C Q - D
K - D K - H K - C K - S A - C A - S A - H A - D Sorted by suit and value: 9 - C 10 - C J - C Q - C K - C A - C 9 -D 10 -D J -D Q - D K - D A - D 9 - H 10 - H J - H Q - H K - H A - H 9 -S 10 - S J - S Q - S K - S A - S