Question: Did You Ever Have To Make Up Your Mind? Write a program using Scanner to help you decide what to do this weekend. Imagine you
Did You Ever Have To Make Up Your Mind? Write a program using Scanner to help you decide what to do this weekend.
Imagine you only ever do three things at the weekend: go shopping, watch a movie, or just stay what you do depend on three things: the weather good or bad; how much money you have rich or poor and whether your parents are visiting. You say to yourself: If my parents are visiting and the weather's bad, we'll stay in If they're visiting and the weather's good, we'll go to the cinema. If they're not visiting and Im poor, I'll stay in If they're not visiting and the weather is good and Im rich, I'll go shopping. Otherwise, I'll go to the cinema.
Create a program asking whether the parents are visiting, whether the weather is good and whether you are rich or poor. Your program should print go to the cinema" go shopping" or "stay in as appropriate.
Hint: There are two possibilities for the "Parents visiting?" question, two for the is weather good?" question, and two for the "are you rich?" question. That gives eight possible cases:
Are parents visiting?
Is the weather good?
Are you rich?
What you do
y
y
y
cinema
y
y
n
cinema
y
n
y
stay in
y
n
n
stay in
n
y
y
shopping
n
y
n
stay in
n
n
y
cinema
n
n
n
stay in
The problem can be solved by testing a lot fewer cases than but if you get confused, the full case solution might provide a way to understand all of the possibilities.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
