Question: java QUESTION 3 (25 points): Here is a simple piece of code that asks the user whether they are male or female. Save, compile, run

java
QUESTION 3 (25 points): Here is a simple piece of code that asks the user whether they are male or female. Save, compile, run and test the code in two file called UnderstandingIFProgram.java and Understanding IFProgramTest.java: import java.util.Scanner; public class Understanding IFProgram private char input; private boolean male; public void question() { System.out.print("Are you (M) ale or (F) emale ? ... "); input = new Scanner(System.in).nextLine().charAt(0); /* missing code, the output should be either "OK, now I know that you are a female." or "OK, now I know that you are a male." */ } public class UnderstandingIFProgramTest { public static void main(String args[]) { UnderstandingIFProgram u = new UnderstandingIFProgram(); u.question(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
