Question: In the following code, the user is supposed to enter the gender (M for male, F for female and X for do not wish to
In the following code, the user is supposed to enter the gender (M for male, F for female and X for do not wish to enter). The code will then print whether the person is male or female or did not prefer to answer
Note: to check equality in character, you use a single quotation instead of double. ('A', 'a', 'b')
| char gender = scan._______ ().charAt(0); |
| String result; |
| if ( _______ == _______ ){ |
| _________ = "You are Male"; |
| }else if (_________ ==________ ){ |
| __________ = "You are Female"; |
| }else{ |
| ___________ = "you did not mention your gender; |
| } |
| System.out.println("Gender : " +__________ ); Fill in the blanks to the incomplete program. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
