Categories
Computer science

You’ll need to implement both the merge sort and quicksort sorting algorithms.

Place your order now for a similar assignment and have exceptional work written by our team of experts, At affordable rates

For This or a Similar Paper Click To Order Now

Using C++, Java, or Python, 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 both the merge sort and quicksort sorting algorithms. For example, you could
use merge sort to sort by value and a quicksort 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.

For This or a Similar Paper Click To Order Now

Leave a Reply