Suppose when you run the following
public class Test {
public static void main(String[] args) {
java.util.Scanner input = new java.util.Scanner(System.in);
double x = input.nextDouble();
double y = input.nextDouble();
double z = input.nextDouble();
System.out.println((x < y && y < z) ? “sorted” : “not sorted”);
}
}
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Instructor Solutions Manual For Introduction To Java Programming And Data Structures, Comprehensive Version, 11th Edition
Additional Engineering Textbook Solutions
Starting Out with Python (3rd Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Using MIS (10th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
- I have my code here and I am getting errors (I have also attached my code): " import java.util.Compiler; public class Test Score { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Ënter the first exam Score: "); Double Score1 = scan.nextDouble(); System.out.println("Enter the second exam Score: "); Double Score2 = scan.nextDouble(); System.out.println("Enter the third exam Score: "); Double Score3 = scan.nextDouble(); System.out.println("Enter the fourth exam Score: "); Double Score4 = scan.nextDouble(); System.out.println("Enter the fifth exam Score: "); Double Score5 = scan.nextDouble(); Double total = Score1 + Score2 + Score3 + Score4 + Score5 Double average = total/5; if (average >= 90) { System.out.printf("your average was a: %f and recieved an A in this Class", average ); } else if (average >= 80) {…arrow_forwardprogram that takes a first name as the input, and outputs a welcome message to that name. Ex: If the input is: Chrystal the output is: Hey Chrystal! Welcome to zyBooks!arrow_forwardWrite an expression that will cause the following code to print "I am an adult" if the value of userAge is greater than 19. 1 import java.util.Scanner; 3 public class AgeChecker { public static void main (String ] args) { 4 int userAge; 7 Scanner scnr = new Scanner(System.in); userAge = scnr.nextInt(); // Program will be tested with values: 18, 19, 20, 21. 8 9 10 if (//your code goes here) { System.out.println("I am a teenager"); } else { System.out.println("I am an adult"); } } 11 12 13 14 15 16 17 18 }arrow_forward
- This isn't not working for me. import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userNum = in.nextInt(); int divNum = in.nextInt(); System.out.print("What is the user number?"); userNum = scnr.nextInt(); int a, b, c; a = userNum/divNum; System.out.println(a); b = a/divNum; System.out.println(b); c = b/divNum; System.out.println(c); }} ERROR LabProgram.java:6: error: cannot find symbol int userNum = in.nextInt(); ^ symbol: variable in location: class LabProgram LabProgram.java:7: error: cannot find symbol int divNum = in.nextInt(); ^ symbol: variable in location: class LabProgram 2 errorsarrow_forwardThe following program has 10 blanks, all of which can be deduced from other given parts of the program. blank java.util.Scanner; public class Perimeter { public static Blank main(String [] args) { double length, width, Blank ; Scanner Blank= new Scanner(); System.Blank .print("Enter the length of the rectangle: "); length = scan.nextDouble(); System.out.print("Enter the width of the rectangle: "); width = scan.next Blank(); perimeter = Blank*2 + width*2; System.out. ("%s%f%s, "The perimeter of the rectangle is " + Blank + " inches."); }//end blank method }//end classarrow_forwardWrite code that outputs variable numBaths as follows. End with a newline. Ex: If the input is: 3 the output is: Baths: 3 1 import java.util.Scanner; 2 3 public class OutputTest { public static void main (String [] args) { int numBaths; 4 5 // Our tests will run your program with input 3, then run again with input 6. // Your program should work for any input, though. 7 8 new Scanner(System.in); scnr.nextInt(); 9. Scanner scnr = 10 numBaths %3D 11 12 System.out.println(numBaths); 13arrow_forward
- Write code that outputs variable numBirds as follows. End with a newline. Ex: If the input is: 3 the output is: Birds: 3 1 import java.util.Scanner; 2 3 public class OutputTest { public static void main (String [] args) { int numBirds; 4 // Our tests will run your program with input 3, then run again with input 6. // Your program should work for any input, though. Scanner scnr = new Scanner(System.in); 7 8 10 numBirds scnr.nextInt(); 11 12 /* Your code goes here */ 12arrow_forwardclass Output{public static void main(String args[]){Integer i = new Integer(557);float x = i.floatValue();System.out.print(x);}} What will the given code prints on the output screen.arrow_forwardimport java.util.Scanner; public class leapYearLab { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userYear; boolean LeapYear; System.out.println("Enter the year"); userYear = scnr.nextInt(); isLeapYear(userYear); //if leap year if (isLeapYear){ System.out.println(userYear + " - leap year"); } else{ System.out.println(userYear + " - not a leap year"); } scnr.close(); } public static boolean isLeapYear(int userYear){ boolean LeapYear; /* Type your code here. */ if ( userYear % 4 == 0) { // checking if year is divisible by 100 if ( userYear % 100 == 0) { // checking if year is divisible by 400 // then it is a leap year if ( userYear % 400 == 0) LeapYear = true; else LeapYear = false; } // if the year is not divisible by 100 else…arrow_forward
- Create a Flowchart //Java Source Code :- import java.util.Scanner; public class bExpert { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("\nVALUES"); System.out.print("Value 1: "); int v1 = sc.nextInt(); System.out.print("Value 2: "); int v2 = sc.nextInt(); System.out.print("Value 3: "); int v3 = sc.nextInt(); System.out.println("\nPROCESS"); System.out.println("\n1. Summation"); System.out.println("2. Product"); System.out.println("3. Min / Max"); System.out.println("4. Odd / Even"); char st = 'y'; while(st != 'n'){ System.out.print("\nCHOICE: "); int ch = sc.nextInt(); switch(ch) { case 1: int sum = v1 + v2 + v3; System.out.println("\nSum = "+sum); break; case 2: int prod =…arrow_forward1. What is the output of the following program? import java.util.Scanner; public class Factorial { public static void main(String args[]){ Scanner scanner = new Scanner(System.in); System.out.printIn("Enter the number:"); scanner.nextInt(); int factorial = fact(num); System.out.println("Factorial of int num = entered number is: "+factorial); } static int fact(int n) { int output; if(n==1){ return 1; } output = fact(n-1)* n; return output; } }arrow_forwardIs this the correct Java programming code when repeat the images below using the text method of input and output? import java.util.Scanner; public class Main { public static void main(String[] args) { //scanner object Scanner scnr = new Scanner(System.in); String name,street,city,postalcode; //input System.out.print("What is your name? "); name = scnr.nextLine(); System.out.print("stret name "); street = scnr.nextLine(); System.out.print("City name "); city = scnr.nextLine(); System.out.print("Postal code "); postalcode = scnr.nextLine(); } }arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education