Question: Here is my code. When I input 1 and 3 I get both Go watch a movieStay inside. How can I change it so that
Here is my code. When I input 1 and 3 I get both Go watch a movieStay inside. How can I change it so that it only gives go watch a movie. I will finish my project by continuing my if statements to satisfy all variations.import java.util.Scanner; public class Lab3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Is the weather good or bad: good = 1, bad = 2: "); double weather = input.nextInt(); System.out.print("Are your parents visiting: yes = 3, no = 4: "); double parents = input.nextInt(); System.out.print("Are you rich or poor: yes = 5, no = 6: "); double wealth = input.nextInt(); if (weather == 1 && parents == 3){ System.out.print("Go watch a movie"); } if (weather == 2 && parents == 3);{ System.out.print("Stay inside"); } } }
Are parents visiting? Is the weather good? Are you rich? What you do ny n
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

import java.util.Scanner; public class Lab3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Is the weather good or bad: good = 1, bad = 2: "); double weather = input.nextInt(); System.out.print("Are your parents visiting: yes = 3, no = 4: "); double parents = input.nextInt(); System.out.print("Are you rich or poor: yes = 5, no = 6: "); double wealth = input.nextInt(); if (weather == 1 && parents == 3){ System.out.print("Go watch a movie"); } if (weather == 2 && parents == 3);{ System.out.print("Stay inside"); } } }