I am not able to get the output for Project: Ellipoid List Menu App Page 7 of 10. I get the message: Exception in thread “main” java.io.FileNotFoundException: P (The system cannot find the file specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
at java.base/java.io.FileInputStream.
at java.base/java.util.Scanner.
at EllipsoidListMenuApp.main(EllipsoidListMenuApp.java:32)
—-jGRASP wedge2: exit code for process is 1.
—-jGRASP: operation complete.
Code:
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
/**
*
*
* @author Ronald Funes
* @version EllipsoidListApp.Java
*/
public class EllipsoidListMenuApp
{
public static void main(String[] args) throws FileNotFoundException
{
// Build a scanner object to get read filename
Scanner keyboard = new Scanner(System.in);
System.out.print(“Enter file name: “);
String filename = keyboard.nextLine();
// Close the keyboard
keyboard.close();
System.out.println();
//Build a list
ArrayList
// Use scanner to read file
Scanner infile = new Scanner(new File(filename));
// Store the name in a local variable
String name = infile.nextLine();
//Use while loop to read the lines
while (infile.hasNext()) {
// add to the list
String ename =infile.nextLine();
double a = infile.nextDouble();
double b = infile.nextDouble();
double c = infile.nextDouble();
if (infile.hasNext())
infile.nextLine();
elist.add(new Ellipsoid(ename, a, b, c));
}
infile.close();
// Build EllipsoidList object
EllipsoidList app = new EllipsoidList(name, elist);
// print to string
System.out.println(app.toString());
System.out.println();
// print summary
System.out.println(app.summaryInfo());
}
}