Commit 092fa884 authored by Rohit Prasad's avatar Rohit Prasad

Fix bug for EOF when input is provided as file

parent c8a9c8c2
...@@ -15,6 +15,10 @@ public class Main { ...@@ -15,6 +15,10 @@ public class Main {
System.out.println("Provide input in this format:"); System.out.println("Provide input in this format:");
System.out.println("type,from,stock,qnt,price"); System.out.println("type,from,stock,qnt,price");
String line = br.readLine(); String line = br.readLine();
// to check EOF
if (line == null) break;
String[] inputs = line.split(","); String[] inputs = line.split(",");
Customer c = new Customer(inputs[1]); Customer c = new Customer(inputs[1]);
...@@ -43,6 +47,8 @@ public class Main { ...@@ -43,6 +47,8 @@ public class Main {
System.out.print(count++ + ": "); System.out.print(count++ + ": ");
System.out.println(o); System.out.println(o);
} }
} else {
System.out.println("No matching orders found.");
} }
System.out.println(); System.out.println();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment