Question: Program Specification: 1. You are to first to write a Class named Card. Card.java A simple class which models a single playing card (from the

Program Specification: 1. You are to first to write a Class named Card. Card.java A simple class which models a single playing card (from the deck of cards that has been described in Howeworks 1 and 2) by its two defining characteristics, which are its suit and its rank. Your Card class must adhere to the following: (a) All instance variables must be private (b) Include the standard public accessors (c) Include the standard private mutators You must not set suit nor rank to something that is not in the domain of the mapping that is inherent to your String toString() method. Do nothing when an argument is invalid (d) All access of instance data by the other instance methods is made via the accessors and mutators. (e) Include the standard default constructor By default a Card is the Ace of Clubs (f) Include the standard specifying constructor (g) Contain a method Card clone () which creates and return a reference to a copy of the calling (h) Contain a method boolean equals (Card guest) which returns whether or not guest has the (i) Contain a method String toString) which returns a String representation of the calling Card Card object same suit and rank as the calling Card object object's suit and rank in some reasonable format 2. You are then to write a Class named CardDriver ardDriver.java A simple class which "tests" Your Card class by carrying out the following actions: (a) Declare and create an array of Card, of size 52 (A deck). (b) Fill the deck with the 52 unique playing cards (in any order) (c) Apply 100 random transpositions of cards to the deck. A transposition: . Generate two random indices (each in the range 0 to 51) o Swap the two cards at these indices (d) Display the contents of the deck, from index 0 to index 51 (e) Find and display the index of the Queen of clubs in the deck Sample run(s) The Queen of clubs was found at location 42
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
