Question: Java program D(4 point) Suppose salty and spicy are variables of type boolean. Write an if-else statement that does two things if these variables are

Java program
 Java program D(4 point) Suppose salty and spicy are variables of

D(4 point) Suppose salty and spicy are variables of type boolean. Write an if-else statement that does two things if these variables are both true: it outputs the String "I do not like spicy and salty food" and changes the value of tip to 0.0. Otherwise it checks to see if salty is false and spicy is true and outputs in this case the string "I do not like spicy food" and sets tip to 0.05. If this did not happen it then checks to see if salty is true and spiey is false and in this case it outputs the string "I do not like salty food" and again sets tip to 0.05. If neither spicy nor salty is true then it outputs the string "I like this food" and sets tip to 0.15

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!