Question: Use Java Please Do the Second Program I need the second Program First program: The first program will create a new external file and place

Use Java Please

Do the Second Program

I need the second Program

First program:

The first program will create a new external file and place the following information about 6 students in the file:

  1. Name
  2. ID number
  3. GPA

Each of the above pieces of information is a field. One record contains all three fields - so there are three fields for each record. Each record represents one student. Have the program place 6 records in the new file.

Second program:

The second program will open the external file created by the first program, read each record, and display each record on a separate line as follows:

Name, ID number, GPA

Please separate each field within the record with a comma and a space when you print it out. Don't forget the space! It's how we read things!

Submit both of these programs along with the external file.

NOTE 1: You may be tempted to use other means of processing File I/O that you come across on the internet. DO NOT USE any other means of processing files other than what is introduced in the lectures. Any program that uses something different will result in a grade of 0. NO EXCEPTIONS.

NOTE 2: 1. Declare all variables within the data declaration section of each class and method. (-5) 2 Do not get input on the same line as a variable declaration. (-5) 3. Do not place an equation for computation on the same line as declaring a variable. (-5)

First Program

Main Class

import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Scanner;

/** * * @author ltvin */ public class MainStudentClass {

/** * @param args the command line arguments */ public static void main(String[] args) throws FileNotFoundException { //local variables int n = 6; Scanner scanner = new Scanner(System.in);

//***************************************************************************************************// //Enter 6 student information studentDataDetails details = new studentDataDetails(); details.getDetailsOfStudent(n); //Create a file for student data PrintStream output = new PrintStream(new File("studentDataDetails.txt")); output.println("Name"+"\t"+"Id number"+"\t\t"+"GPA"); output.println("************************************"); for(int i=0;i

____Driver___

import java.util.Scanner;

public class studentDataDetails { //Variables public String name[][] = new String[10][10]; private int numberData; //Get Details of The Students public void getDetailsOfStudent(int n) { Scanner scanner = new Scanner(System.in); numberData = n; System.out.println("Enter "+numberData+" Student Details "); for(int i=0; i

for(int j=0;j<3;j++) { name[i][j] = scanner.nextLine(); } } print(numberData); } //Display the Results public void print(int numberData) { System.out.println("Name"+"\t"+"Id number"+"\t \t"+"GPA"); for(int i=0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!