Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Have created the scanner for getting input but can't seem to get the yes, y or no, n into boolean, still write everything out and
Have created the scanner for getting input but can't seem to get the yes, y or no, n into boolean, still write everything out and an explanation so i can understand, code in java. Thank you
Get User Input You will need to ask the user the following prompts and have some manner of using their responses for the boolean conversion. 1. Do you consider yourself brave? 2. Are you the class clown? 3. Are you competitive? 4. Are you a good learner? 5. Do you hold your friends and family above all else? 6. Do you tend to be the leader? Convert the input to Boolean We asked the user for yeso answers to the questions. We now need to String compare each input to convert it to a boolean. That is, if the user entered yes or y (case insensitive), then the boolean value is true. If they entered "no" or "n" (case insensitive), then the boolean value is false. Don't worry about error handling or asking the user to retry if they make a typo - just treat those as "false". . Calculate & Display the Results Now that we have the responses converted from the user, we need to figure out which Hogwarts house they go into and display it: If someone is brave and puts family & friends above all else or tends to be the leader, then they are Gryffindor If someone is not the class clown and tend to be competitive, then they are Slytherin If someone is a good learner or competitive and are brave but not the leader, then they are Ravenclaw If someone is the class clown and is not brave and does not tend to be the leader, then they are Hufflepuff . Once we have the user's house, simply print out a statement announcing it (ie: Congratulations, you are House Ravenclaw!")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