Question: Please try to use Switch and case statements rather than If statements Card Name Ace Two Three Four Five Point Value 4 Seven Eight Nine



Please try to use Switch and case statements rather than If statements
Card Name Ace Two Three Four Five Point Value 4 Seven Eight Nine 10 Jack een Kin Joker Table 2: A table showing name of playing cards and their related values in "Golf". 3. Public static String getFullCardName This method should take in a String as an input/parameter, which will represent the notation for a card. The notations for the cards are given in Table 3 Notation Full Name Ace Jack Kin 2...10 Two...Ten Diamonds Hearts Spades Clubs Invalid Table 3: A table showing the notation and full names used for playing card. The String input would be situated in the order of card value followed by suite, so "l0H" would be "Ten Else Of Hearts" and "KC" would be "King Of Clubs". To do this, the method should divide the String into two separate strings representing the value and suite. This can be done properly by looking at the length of the String and dividing it accordingly (Hint: Use String class and an "if/else" statement). Once you have two separate strings, create two switch/case statements (one for value, one for suite) to save the full names of the notations as strings and combine them together at the end of the method to create a complete name for the card. This complete name for the card should be returned at the end of the method. 4. Public static main (String Il args) Print out a menu similar to that shown in Figure 2 and save the user's response Welcome To Switch/Case Practice! Please Choose An Option 1. Determine A Letter Grade From A Percentage 2. Determine The PlayingCard Value Of A Card In 'Golf 3. Determine The Full Name Of An Abbreviated Playing Card Figure 2: A figure showing the possible menu layout of this class. Depending on the option chosen by the user, the program will prompt the user for the necessary information to run the related methods that have been created for this lab. Figure 3 shows potential outputs of Option 1, Figure 4 shows potential outputs of Option 2, and Figure 5 shows potential outputs of Option3 Numeric Grade Possibilities Enter A Percentage Grade 73 A percentage grade of 73 would be a C. 125 is not a valid percentage grade Numeric Grade Possibilities Enter A Percentage Grade 125 Figure 3: A figure showing potential outputs for Option 1 from Figure 2 Card Value In Golf Enter The Name Of The Card: seven Card Value In Golf 7 Card Value In Golf Enter The Name Of The Card: Joker Card Value In Golf: -2 Card Value In Golf Enter The Name Of The Card: Diamond Card Value In Golf: 100 Figure 4: A figure showing potential outputs for Option 2 from Figure 2 Card Name From Abbreviation Enter Abbreviation 9h Full Name Nine Of Hearts Card Name From Card Name From Abbreviation Abbreviation Enter Abbreviation Enter Abbreviation: AC Full Name: Ace of Clubs 11J Full Name: Invalid Of Invalid Figure 5: A figure showing potential outputs for Option 3 from Figure 2 If a response was taken in that does not indicate any of the three options, output an error message stating "You have chosen an invalid option", as can be seen in Figure 6 You have chosen an invalid option
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
