These are the three excel files which the user can enter 380

These are the three excel files which the user can enter:

380-fall-2002

437-fall-2002

437-fall-2003

I have three excel files. The file that has to be read depends on what file the user needs to open. If the user types in one of the files listed above, then it will read the contents of that file only.

This is what I have to get the file from the user:

Scanner in = new Scanner(System.in);
System.out.println(\"Please enter a file name.\");
String input = in.nextLine();
File file = new File(input);

if(input.equals(\"380-fall-2002.csv\")){
      
  
   try {
       BufferedReader crunchifyBuffer = null;
       String cLine;
       crunchifyBuffer = new BufferedReader(new FileReader(\"/Users/pannee/Downloads/380-fall-2002.csv\"));
      

Solution

Please find the required program along with its output. Please see the comments against each line to understand the step.

-----------------------------------------------------

OUTPUT:

Please enter a file name.
380-fall-2002.csv

autumn, 24.5, 27

winter, 12.3, 16

These are the three excel files which the user can enter: 380-fall-2002 437-fall-2002 437-fall-2003 I have three excel files. The file that has to be read depen

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site