Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CHALLENGE ACTIYITY 3.2.2: Basic if-else expression. Start Write an expression that will cause the following code to print 'greater than 18' if the value of

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

CHALLENGE ACTIYITY 3.2.2: Basic if-else expression. Start Write an expression that will cause the following code to print 'greater than 18' if the value of userAge is greater than 18. D-D - D - import java.util.Scanner; public class gechecker { public static void mein (String [] args) { int userdee; Scanner scnr = new Scanner(System.in); userige = scnr.nextInt(); // Program will be tested with values: 17, 18, 19, 29. if (* Your solution goes here */) i System.out.println("Ereater than 18"); else System.out.println("18 or less"); 2 Check Next CHALLENGE ACTIVITY 3.2.3: Basic if-else. Start D-D- Write an if-else statement for the following: If userTickets is greater than 5, execute award Points = 10. Else, execute awardpoints = userTickets. Ex: If userTickets is 14, then awardpoints = 10. 1 import java.util.Scanner; 3 public class TicketCounter i public static void main(String [] args) { int awardpoints; int userTickets; Scanner scor = new Scanner(System.in); userTickets = scor.nextInt(); // Program will be tested with values: 4, 5, 6, 7. UPUD JOU /* Your solution goes here */ System.out.println( awardpoints); Check Next CHALLENGE ACTIYITY 3.3.2: If-else statements. Jump to level 1 Write multiple if statements: If carYear is before 1967, print 'Probably has few safety features.' (without quotes). If after 1969, print 'Probably has seat belts.'. If after 1992, print 'Probably has electronic stability control.'. If after 2000, print 'Probably has airbags.'. End each phrase with period and newline. Ex: carYear = 1995 prints: Probably has seat belts. Probably has electronic stability control. 1 public class SafetyFeatures 2 public static void main(String [] args) { int carYear; car Year = 1965; 6 O CHALLENGE 3.4.2: Equality and relational expressions. D Jump to level 1 Write an expression that will cause 'Foot or less' to print if the value of numlnches is less than or equal to 12 - D-D- import java.util.Scanner; public class EqualityAndRelational i public static void main(String [] args) { int numi nches; Scanner scnr = new Scanner(System.in); numinches = sehr.nextInt(); // Program will be tested with values: 11, 12, 13, 14. if (* Your solution goes here +) { System.out.println("Foot or less"); else { System.out.println("More than a foot "); 17 } 18

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

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

1. How might volunteering help the employer and the employee?

Answered: 1 week ago