Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

2. Why has the conflict escalated?

Answered: 1 week ago

Question

1. What might have led to the misinformation?

Answered: 1 week ago