Question
The question is the first picture and my output is the second picture. I can't figure out what is wrong (Java) My code is here:
The question is the first picture and my output is the second picture. I can't figure out what is wrong (Java)
My code is here:
import java.util.Scanner;
public class AirportInfo {
public static void printAirportInfo(String var1, String var2) { System.out.println(var1 + " is " + var2 + "'s airport code."); }
public static void main (String [] args) { Scanner scnr = new Scanner(System.in); String code1 = scnr.nextLine(); String code2 = scnr.nextLine(); String city1 = scnr.nextLine(); String city2 = scnr.nextLine(); printAirportInfo(code1, city1); printAirportInfo(code2, city2);
} }
Jump to level 1 Read four strings from input and call printAirportinfo0 to output as follows. EX: If the input is WAW PDX Warsaw Portland, then the output is: WAW is Warsaw's airport code. PDX is Portland's airport code. X 1: Compare output Exception in thread "main" java.util. NoSuchElementException: No line found at java.base/java.util.Scanner.nextLine (Scanner.java:1651) at Airportinfo.main (Airportinfo.java:14) Input Your output Your program produced no output Expected output 2: Compare output x Exception in thread "main" java.util.NoSuchElementException: No line found at java.base/java.util.Scanner.nextLine (Scanner.java:1651) at Airportinfo.main (Airportinfo.java:14) Input Your output Your program produced no output Expected outputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started