Question & Answer: BlucJ puts in and create a main method soll be graded scparately. You may use any resources except for odher Write this program in stages When you ar…..

BlucJ puts in and create a main method soll be graded scparately. You may use any resources except for odher Write this program in stages When you are done upload your java file here. When you have submitted your java, check with your In BlueJ, create a new class called Final. This will create a file called Final java. Then erase the extra code that Each stage for this s assigiment instructor to ensure it has been properly received You can download the text file we will be using for this challenge here: testscores.txt Make sure you put your name, the date and your section (days times of class meeting) i top of the file. Stage 1: In your main method Open the file testscores.ext and create a Scanner object .Read the data into arrays named: score o id number o namc Stage 2 Create a method that does not return a value named printRoster will print the names and IDs of the students from the file. The output should look like this: Mary Smart 8091449 Tomas Smith Jr- 0214011 sally Fields 8681992 Johnny Rich 8099812 Viki Beckwith 8863341 Connie Ditto 8072178 Antonio Beecham 0485222 Antwan Mathis 0086057
media%2F1c4%2F1c4ac8c9-7264-4c54-828c-1f

BlucJ puts in and create a main method soll be graded scparately. You may use any resources except for odher Write this program in stages When you are done upload your java file here. When you have submitted your java, check with your In BlueJ, create a new class called Final. This will create a file called Final java. Then erase the extra code that Each stage for this s assigiment instructor to ensure it has been properly received You can download the text file we will be using for this challenge here: testscores.txt Make sure you put your name, the date and your section (days times of class meeting) i top of the file. Stage 1: In your main method Open the file testscores.ext and create a Scanner object .Read the data into arrays named: score o id number o namc Stage 2 Create a method that does not return a value named printRoster will print the names and IDs of the students from the file. The output should look like this: Mary Smart 8091449 Tomas Smith Jr- 0214011 sally Fields 8681992 Johnny Rich 8099812 Viki Beckwith 8863341 Connie Ditto 8072178 Antonio Beecham 0485222 Antwan Mathis 0086057

Expert Answer

 

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

public class StudentRecords {

public static void main(String[] args) {

File recordFile = new File(“C:\Users\mahajan\Desktop\studentRecords.txt”);

String name[] = new String[100];

int marks[] = new int[100];

int id[] = new int[100];

int numRecords=0;

try {

Scanner sc = new Scanner(recordFile);

while (sc.hasNext()) {

String line = sc.next();

String rec[] = line.split(“,”);

marks[numRecords] = Integer.parseInt(rec[0]);

id[numRecords] = Integer.parseInt(rec[1]);

name[numRecords] = rec[2];

numRecords++;

}

sc.close();

printRoaster(id, name, numRecords);

}

catch (FileNotFoundException e) {

e.printStackTrace();

}

}

public static void printRoaster(int id[], String name[], int numRecords) {

for(int i=0;i<numRecords;i++) {

System.out.println(name[i]+”: “+id[i]);

}

}

}

content of the file studentRecords.txt

10,1234,john
20,123,jom
21,12,jim

Still stressed from student homework?
Get quality assistance from academic writers!