Question
I can't figure out how to fix this error in the code below: java.util.NoSuchElementException: No line found at java.base/java.util.Scanner.nextLine(Scanner.java:1656) at Main.main(Main.java:31) public class TravelTimeData {
I can't figure out how to fix this error in the code below:
java.util.NoSuchElementException: No line found
at java.base/java.util.Scanner.nextLine(Scanner.java:1656)
at Main.main(Main.java:31)
public class TravelTimeData { private int COGID; private String firstDirection; private String secondDirection; private int firstTime; private int secondTime; private int timeDifference; public TravelTimeData(int COGID, String firstDirection, String secondDirection, int firstTime, int secondTime) { this.COGID = COGID; this.firstDirection = firstDirection; this.secondDirection = secondDirection; this.firstTime = firstTime; this.secondTime = secondTime; this.timeDifference = Math.abs(firstTime - secondTime); } public int getTimeDifference() { return timeDifference; } public String toString() { return COGID + " " + firstDirection + " " + firstTime + " " + secondDirection + " " + secondTime; } }
import java.util.Scanner; import java.io.File; import java.io.IOException; import java.util.ArrayList; //https://www.w3schools.com/java/java_arraylist.asp
public class Main {
public static void main(String[] args) { ArrayList
/* Take the data and return the route with the largest travel time differential. */ public static TravelTimeData getLargestDifferential(ArrayList
Step 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