Question: Your class should have two constructors: - One that takes an int and a String. The integer ( 2 through 1 4 ) is used

Your class should have two constructors: - One that takes an int and a String. The integer (2 through 14) is used to set the card value. (2 through 10 are obvious. Jack has value 11, Queen has value 12, King has 13, and Ace has 14). The String sets the suit. To set the suit, look at the first letter of the argument, ignoring upper/lowercase, and if it is {s,h,c,d} then set the suit accordingly (Spades, Hearts, Clubs, Diamonds). - Another constructor takes a String and parses it to set the card value and suit. If the first character in the string is 2 through 9 or J, Q, K, or A (ignore upper/lowercase), then set the card value in the obvious way. If the first character is 1, then the second character must be 0 to indicate a card value of 10. The following character should be {s,h,c,d} to specify the suit. Accept either uppercase or lowercase letters to set the suit. Any following characters in the input parameter can be ignored. - If there is any error in the input to the constructor, the card value should be set to 0 and the suit should be set to ERROR. What are errors? Values not in the range from 2 through 14(or not 'j','q','k', or 'a' for the second constructor), or suit letters other than s, h, c, d. In addition to the constructors, please add the following methods: - Value(): returns the cards value as an integer in the range from 2 through 14. - Suit(): returns the cards suit as a String. The suit should be represented as a single capital letter: S,H,C, or D - A method called toString() that returns a String showing the value and then the suit, with no space between them. However, instead of printing 11 for Jack, 12 for Queen, etc instead print J for Jack, Q for Queen,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!