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

HiloNames Create a program named HiloNames that read a file named \"testscores.t

ID: 3557909 • Letter: H

Question

HiloNames

Create a program named HiloNames that read a file named "testscores.txt".Each line of this file has a test score followed by and id number and then a name, for example ( there are spaces of tabs between the test score, the id , and the name.)

testscores.txt

89 0912364 Sam Jones

55 011949 John Regal

98 0091449 Mary Smart

100 0214011 Tomas Smith Jr.

65 0601992 Sall Fields

22 0099812 Johnn Rich

Write a program that reads this file and print the ID numbers of who got a 70 or better score and whoe got less than a 70 score. The file will alwasys have less than or equal 100 students. Your program should output like below of the above file, note the two spaces of indenting before the student is( note same in section with the file)

70 or better:

0912364

091449

0214011

Less than 70:

0119459

0601992

0099812

Explanation / Answer

//Will work Now
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

public class HiloNames {
   public static void main(String[] args) throws FileNotFoundException{
    Scanner inFile = new Scanner(new FileReader("C:\Users\Sam Flynn\Desktop\testscores.txt"));
    String[] Input = new String[100];
    String[][] finalInput = new String[100][3];
    int i=0;
    while(inFile.hasNextLine() && i <100){
        Input[i] = inFile.nextLine();
        finalInput[i] = Input[i].split(" ");

        i++;
    }
    int k=0;
    System.out.println("70 or better:");
    while(finalInput[k][0]!= null){
        if(Integer.parseInt(finalInput[k][0]) > 70){
            System.out.println(finalInput[k][1]);
        }
        k++;
    }

k=0;
    System.out.println("Less than");
      while(finalInput[k][0]!= null){
        if(Integer.parseInt(finalInput[k][0]) < 70){
            System.out.println(finalInput[k][1]);
        }
        k++;
    }
}

}

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