Question: Java code edit/correction: I need someone to correct the code below so it compiles correctly into Jgrasp exactly as typed, ( I am a beginner

Java code edit/correction: I need someone to correct the code below so it compiles correctly into Jgrasp exactly as typed, ( I am a beginner and trying to learn). I will put the sample output of what it should display directly below this description. I have additional information on program requirements if needed (simply comment for additional information). In addition, if it's not too much trouble, please comment throughout the code, so I can better learn what each part is doing. Thank you for your time!

Java code edit/correction: I need someone to correct the code below so

Sample Code

Main.java

-----------------------------------------

package com.school;

import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List;

import javax.swing.JFrame; import javax.swing.JOptionPane;

public class Main { public static void main(String[] args) { StudentLogic studentLogic = new StudentLogic(); JFrame frame = new JFrame("Student Details"); Student student = new Student(); while(student.getFirstName()==null || student.getFirstName().equals("")){ student.setFirstName(JOptionPane.showInputDialog( frame, "Enter the first name ", JOptionPane.WARNING_MESSAGE )); } student.setFirstName(JOptionPane.showInputDialog( frame, "Enter the last name ", JOptionPane.WARNING_MESSAGE )); student.setTermAndYear(JOptionPane.showInputDialog( frame, "Enter the term/year ", JOptionPane.WARNING_MESSAGE )); student.setNoOfClasses((Integer.parseInt(JOptionPane.showInputDialog( frame, "Enter the no of courses", JOptionPane.WARNING_MESSAGE )))); Course course; ArrayList couseList = new ArrayList(); for(int i =0; i lines = new ArrayList(); lines.add("STUDENT SEMESTER REPORT FILE"); lines.add("Student Name: "+student.getFirstName()+" "+student.getLastName()); lines.add("Term/Year: "+student.getTermAndYear()); lines.add(" Class\t\tCredits\t\tGrades"); lines.add("============================================="); Course tempCourse; ArrayList courseLst = student.getCourseList(); for(int i =0; i

} catch (IOException e) { // do something } } }

----------------------------------------------

Student.java

-------------------------------------------------

package com.school;

import java.util.ArrayList;

public class Student { private String firstName; private String lastName; private String termAndYear; private int noOfClasses; private ArrayList courseList; private double gpa; private String status; public Student() { }

public Student(String firstName, String lastName, String termAndYear, int noOfClasses, ArrayList courseList, double gpa, String status) { super(); this.firstName = firstName; this.lastName = lastName; this.termAndYear = termAndYear; this.noOfClasses = noOfClasses; this.courseList = courseList; this.gpa = gpa; this.status = status; }

public double getGpa() { return gpa; }

public void setGpa(double gpa) { this.gpa = gpa; }

public String getStatus() { return status; }

public void setStatus(String status) { this.status = status; }

public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getTermAndYear() { return termAndYear; } public void setTermAndYear(String termAndYear) { this.termAndYear = termAndYear; } public int getNoOfClasses() { return noOfClasses; } public void setNoOfClasses(int noOfClasses) { this.noOfClasses = noOfClasses; } public ArrayList getCourseList() { return courseList; } public void setCourseList(ArrayList courseList) { this.courseList = courseList; } }

------------------------------------------------------------

Course.java

--------------------------------------------------------------

package com.school;

public class Course { private String courseDesc; private double credit; private double grade; public String getCourseDesc() { return courseDesc; } public void setCourseDesc(String courseDesc) { this.courseDesc = courseDesc; } public double getCredit() { return credit; } public void setCredit(double credit) { this.credit = credit; } public double getGrade() { return grade; } public void setGrade(double grade) { this.grade = grade; } public Course(String courseDesc, double credit, double grade) { super(); this.courseDesc = courseDesc; this.credit = credit; this.grade = grade; } public Course() { } }

--------------------------------------------------------------

StudentLogic.java

--------------------------------------------

package com.school;

import java.text.DecimalFormat; import java.util.ArrayList;

public class StudentLogic { public double gpaCalculator(ArrayList courseList){ double qualityPoint; double sumOfGrades = 0,sumOfCredits=0; for(Course c: courseList){ qualityPoint = calcQualityPts(c.getGrade()); sumOfGrades += qualityPoint*c.getCredit(); sumOfCredits += c.getCredit(); } DecimalFormat df = new DecimalFormat("#.00"); return Double.parseDouble(df.format(sumOfGrades/sumOfCredits)); } public double creditTotal(ArrayList courseList){ double sumOfCredits=0; for(Course c: courseList){ sumOfCredits += c.getCredit(); } return sumOfCredits; } public String courseStatusCalc(double gpa){ String status = ""; if(gpa 1.75 &&gpa = 90){ qPt = 4.0; } else if(grade >= 80 && grade = 70 && grade = 60 && grade STUDENT SEMESTER REPORT FILE Student Name: Smith, John Term/ Year: Fall2013 Credits Class Intro to Comp Sci 3.5 Art History 3.0 3.0 English 101 Chemistry 3.5 Basketball 1.0 GPA: 3.11 Status: Normal Standing Grade 92.5 78.9 84.6 87.2 97.5

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!