please solve this Java program. I need some explain.
############### Student.java ###############
/**
* The Class Student.
*/
public class Student {
/** The name. */
private String name;
/** The major. */
private String major;
/** The grade point. */
private int gradePoint;
/** The credit hours. */
private int creditHours;
/**
* Instantiates a new student.
*
* @param name the name
* @param major the major
* @param gradePoint the grade point
* @param creditHours the credit hours
*/
public Student(String name, String major, int
gradePoint, int creditHours) {
super();
this.name = name;
this.major = major;
this.gradePoint = gradePoint;
this.creditHours =
creditHours;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Gets the major.
*
* @return the major
*/
public String getMajor() {
return major;
}
/**
* Gets the grade point.
*
* @return the grade point
*/
public int getGradePoint() {
return gradePoint;
}
/**
* Gets the credit hours.
*
* @return the credit hours
*/
public int getCreditHours() {
return creditHours;
}
}
##################### GPACalculator.java #############
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
/**
* The Class GPACalculator.
*/
public class GPACalculator {
/** The students. */
private List<Student> students;
/**
* Instantiates a new GPA calculator.
*
* @throws IOException Signals that an I/O exception
has occurred.
*/
public GPACalculator() throws IOException {
this.students = new
ArrayList<>();
readFile();
calculateGPA();
}
/**
* Read file.
*
* @throws IOException Signals that an I/O exception
has occurred.
*/
private void readFile() throws IOException {
System.out.println("****** File
reading started *********");
FileReader fr = new
FileReader("studentdata.txt");
BufferedReader br = new
BufferedReader(fr);
String line = br.readLine();
while ((line = br.readLine()) !=
null) {
String[] data =
line.split(" ");
String name =
data[0];
String major =
data[1];
int gradePoint =
Integer.parseInt(data[2]);
int creditHours
= Integer.parseInt(data[3]);
students.add(new
Student(name, major, gradePoint, creditHours));
}
br.close();
System.out.println("****** File
reading finished *********");
}
/**
* Calculate GPA.
*
* @throws FileNotFoundException the file not found
exception
*/
public void calculateGPA() throws
FileNotFoundException {
System.out.println("****** GPA
calculation started *********");
PrintWriter writer = new
PrintWriter("studentresults.txt");
double csGpa = 0.0;
int cs = 0;
writer.write("Name Major
Grade_points Credit_hours GPA");
writer.println();
for (Student s : students) {
double gpa =
s.getGradePoint() / s.getCreditHours();
if
(s.getMajor().equalsIgnoreCase("cs")) {
csGpa += gpa;
cs++;
}
writer.write(String.format("%s %s %d %d %.2f", s.getName(),
s.getMajor(), s.getGradePoint(), s.getCreditHours(), gpa));
writer.println();
}
writer.println();
writer.println();
writer.write(String.format("Average
GPA of CS Students: %.2f", (csGpa / cs)));
writer.println();
writer.write(String.format("Number
of CS Students: %d", cs));
writer.println();
writer.flush();
System.out.println("****** GPA
calculation finished *********");
writer.close();
}
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception
has occurred.
*/
public static void main(String[] args) throws
IOException {
new GPACalculator();
}
}
############# studentdata.txt ###########
Name Major Grade_point Credit_hours
Jacob CS 42 12
Michael Math 80 25
Joshua CS 48 12
Matthew Art 39 10
Samantha Business 100 34
Elizabeth CS 98 25
Brandon CS 48 12
Dylan Art 39 10
Samuel Art 100 34
Christian Math 98 25
############ studentresults.txt ############
Name Major Grade_points Credit_hours GPA
Jacob CS 42 12 3.00
Michael Math 80 25 3.00
Joshua CS 48 12 4.00
Matthew Art 39 10 3.00
Samantha Business 100 34 2.00
Elizabeth CS 98 25 3.00
Brandon CS 48 12 4.00
Dylan Art 39 10 3.00
Samuel Art 100 34 2.00
Christian Math 98 25 3.00
Average GPA of CS Students: 3.50
Number of CS Students: 4
2. The data file studentData.txt contains a list of student's name, major, grade points, and cred...
Must be written in JAVA Code Write a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written to a file. Each line of the input file will contain the student name (a single String with no spaces), the number of semester hours earned (an integer), the total quality points earned (a double). The following shows part of a typical...
1 and 2 1) For the data listed below as the questions (a) to (d). DATA: 20 25 40 41 42 43 44 45 46 47 48 49 50 50 51 52 53 54 55 56 57 58 59 60 65 80 90 Questions Points a)Make a frequency diagram with 7 classes b) Make a histogram c) Give the five number summary d) Make a box-and-whisker diagram (show outliers.) 2) At a gathering of 190 college students their grade-group and...
Add additional information to the student class below such as name, address, major, and contact information along with all the getters and setters (methods) needed to access all data. Submit your code along with a sample run of your program. Comment all your code. Cite any sources of information you use. Write a note on the process of completing the assignment in a Microsoft Word document. // ShowStudent.java // client to test the Student class class ShowStudent { public static...
Add additional information to the student class below such as name, address, major, and contact information along with all the getters and setters (methods) needed to access all data. Submit your code along with a sample run of your program. Comment all your code. Cite any sources of information you use. Write a note on the process of completing the assignment in a Microsoft Word document. // ShowStudent.java // client to test the Student class class ShowStudent { public static...
8. -/2 points ASWSBE13 3.E.016.MI. My Notes The grade point average for college students is based on a weighted mean computation. For most colleges, the grades are given the following data value A (4), (3), (0). Alter 60 credit hours of course work, a student at State University and credit hours of A, 10 credit hours of B, 2 credit hours of C, and 4 credit hours of D. (a) Compute the student's grade point average Ask Your Teacher (2),...
Use C++ For this week’s lab you will write a program to read a data file containing numerical values, one per line. The program should compute average of the numbers and also find the smallest and the largest value in the file. You may assume that the data file will have EXACTLY 100 integer values in it. Process all the values out of the data file. Show the average, smallest, largest, and the name of the data file in the...
The data from data421.dat contains information on 78 seventh-grade students. We want to know how well each of IQ score and self-concept score predicts GPA using least-squares regression. We also want to know which of these explanatory variables predicts GPA better. Give numerical measures that answer these questions. (Round your answers to three decimal places.) find:(Regressor: IQ) R 2 find: (Regressor: Self-Concept) R 2 obs gpa iq gender concept 1 7.94 103 2 54 2 8.292 111 2 73 3...
Pls both parts for UPVOTE Using Excel create four histograms, properly labeled, depicting the data from the frequency distributions in #a and #b below. a) Using the variable Age, construct TWO frequency distributions to summarize the Ages of students born in the USA and those born outside the USA. Use 5 classes to construct your frequency distribution. For each frequency distribution, show your calculations for the class width and then list the: Lower limits and upper limits Class boundaries Class...
The data from data349.dat contains information on 78 seventh-grade students. We want to know how well each of IQ score and self-concept score predicts GPA using least-squares regression. We also want to know which of these explanatory variables predicts GPA better. Give numerical measures that answer these questions. (Round your answers to three decimal places.) (Regressor: IQ) R 2 (Regressor: Self-Concept) R 2 Which variable is the better predictor? IQ Self Concept obs gpa iq gender concept 1 7.94 112 ...
File Ed Yew ranoform e Srepha Anaivza Custom Hours Work GPA Absences yar ed less than 1... 3.00 4.00 less than 1.. 2 4.00 2.00 less than 1... 2.50 3.00 less than 1.. 3.80 1.00 less than 1.. 2.70 2.00 less than 1. 3.20 5.00 7 less than 1. 4.00 6.00 less than 1.. 8 3.80 7.00 less than 1... 2.90 9.00 10 less than 1... 3.10 4.00 11 less than 1. 3.10 7.00 12 less than 1... 2.00 8.00...