Problem

Making Multiple Comparisons in Decision Statements In this exercise, you use what you...

Making Multiple Comparisons in Decision Statements

In this exercise, you use what you have learned about OR logic. This example program was written for a marketing research firm that wants to determine if a customer prefers Coke or Coke Zero over some other drink Study the following code and then answer Questions 1-4.

1. What is the exact output when this program executes if the customer's name is Chas Matson and the drink is Coke? _____________________________________________________________________________________

_____________________________________________________________________________________

2. What is the exact output when this program executes if the customer's name is Chas Matson and the drink is Coke Zero? _____________________________________________________________________________________

_____________________________________________________________________________________

3. What is the exact output from this program when

if(drink . equal s ("Coke")|| drink . equal s ("Coke Zero"))

is changed to

if(drink.equals("coke") || drink.equals("Coke Zero"))

and the customer's name is still Chas Matson and the drink is still Coke?

_____________________________________________________________________________________

_____________________________________________________________________________________

4. What is the exact output from this program when if(dri nk.equal s ("Coke") II drink. equal s ("Coke Zero")) is changed to

if(drink.equals("Coke") II drink.equals("coke") II

drink. equal s ("Coke Zero") II drink. equal s ("coke zero"))

and the customer's name is Chas Matson, and the drink is coke? What does this change allow a user to enter?

_____________________________________________________________________________________

_____________________________________________________________________________________

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 4
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT