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

Create a java application that allows you to enter student data that consists of

ID: 3715537 • Letter: C

Question

Create a java application that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing (located at StudentsGoodStanding.txt) or those on academic probation (located at StudentsAcademicProbation.txt).

For example, the input:

should save the following to StudentsGoodStanding.txt:

and the following to StudentsAcademicProbation.txt:

Explanation / Answer

ReadStudentsRecords.java

import java.io.File;

import java.io.FileWriter;

import java.io.IOException;

import java.util.Scanner;

public class ReadStudentsRecords {

public static void main(String[] args) throws IOException {

//Declaring variables

int size,id;

String fname,lname;

double gpa;

//Creating the FileWriter references

FileWriter fw1=null,fw2=null;

//Opening the output files

fw1=new FileWriter(new File("StudentsGoodStanding.txt"));

fw2=new FileWriter(new File("StudentsAcademicProbation.txt"));

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

//Getting the input entered by the user

System.out.print("How many Students data you want to enter :");

size=sc.nextInt();

for(int i=0;i<size;i++)

{

//Getting the info of each student

System.out.println("Student#"+(i+1)+":");

System.out.print("Enter id :");

id=sc.nextInt();

System.out.print("Enter Firstname :");

fname=sc.next();

System.out.print("Enter Lastname :");

lname=sc.next();

System.out.print("Enter GPA :");

gpa=sc.nextDouble();

if(gpa>=2.0)

{

fw1.write(id+","+fname+","+lname+","+gpa+" ");

}

else

{

fw2.write(id+","+fname+","+lname+","+gpa+" ");

}

}

//Closing the output files

fw1.close();

fw2.close();

}

}

__________________

Input:

How many Students data you want to enter :3
Student#1:
Enter id :123
Enter Firstname :Dave
Enter Lastname :Brown
Enter GPA :3.4
Student#2:
Enter id :456
Enter Firstname :Sam
Enter Lastname :Jones
Enter GPA :1.8
Student#3:
Enter id :789
Enter Firstname :jane
Enter Lastname :Smith
Enter GPA :3.8

_______________

output:

StudentsGoodStanding.txt

123,Dave,Brown,3.4
789,Jane,Smith,3.8

_____________

StudentsAcademicProbation.txt

456,Sam,Jones,1.8

_____________Thank You

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