Question: Suppose you are writing a program that asks the user to give a yes-or-no response. Assume that the program reads the users response into the

Suppose you are writing a program that asks the user to give a yes-or-no response. Assume that the program reads the user’s response into the Stringvariableresponse.

a. If response is yes or y, set the boolean variable accept to true; otherwise, set it to false.

b. How would you change the code so that it will also accept Yes and Y?

Step by Step Solution

3.53 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a if responseequalsy responseequalsyes accept true else accept false ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java An Introduction to Problem Solving and Progra Questions!