Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

These are the three excel files which the user can enter: 380-fall-2002 437-fall

ID: 3925566 • Letter: T

Question

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"));
      

Explanation / Answer

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote