Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started