Question: String fileName is assigned a file's name read from input. Perform the following tasks: Assign groceryStream with a FileInputStream that opens the file fileName for
String fileName is assigned a file's name read from input. Perform the following tasks:
Assign groceryStream with a FileInputStream that opens the file fileName for reading.
Assign dataFS with a Scanner created using groceryStream.
Click here for example
GroceryDataProcessor.java
pearDatatxt
pearDatatxt
pearDatatxt
import java.util.Scanner;
import java.ioFileInputStream;
import java.ioIOException;
public class GroceryDataProcessor
public static void mainString args throws IOException
Scanner scnr new ScannerSystemin;
String fileName;
double pearWeight;
FileInputStream groceryStream null;
Scanner dataFS null;
fileName scnrnext;
Your code goes here
pearWeight dataFS.nextDouble;
System.out.printlnpearWeight;
groceryStream.close;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
