Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; public class UserNums { public static void main (String [] args) { int userNum1; int userNum2; Scanner input = new Scanner(System.in); userNum1 =

import java.util.Scanner; public class UserNums {

public static void main (String [] args) { int userNum1; int userNum2;

Scanner input = new Scanner(System.in); userNum1 = input.nextInt(); userNum2 = input.nextInt();

/* Your code goes here */

System.out.println("userNum2 is " + userNum2); }

}image text in transcribed

import java.util.Scanner;

public class DetectSenior { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); int patronAge;

patronAge = scnr.nextInt();

/* Your solution goes here */

} }

image text in transcribed

CHALLENGE ACTIVITY 3.3.2: If-else statements. Jump to level 1 Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 1 if userNum2 is greater than 9. Otherwise, print "userNum2 is less than or equal to 9.". End with newline. 1 import java.util.Scanner; 2 public class UserNums { 3 4 public static void main (String [] args) 5 int user Num1; 6 int userNum2; 7 8 Scanner input = new Scanner(System.in); 9 userNum1 input.nextInt(); 10 userNum2 input.nextInt(); 11 12 /* Your code goes here * 13 14 System.out.println("userNum2 is " + userNum2); 15 } 16 17 } 2. Write an if-else statement that checks patronage. If 55 or greater, print "Senior citizen", otherwise print "Not senior citizen" (without quotes). End with newline. 1 test passed All tests passed 1 import java.util.Scanner; 2 3 public class DetectSenior { 4 public static void main (String [] args) { 5 Scanner scnr = new Scanner(System.in); 6 int patronAge; 7 8 patronAge scnr.nextInt(); 9 10 /* Your solution goes here */ 11 12 } 13 } Run Feedback

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions