Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help editing java code to compile (located at bottom). Full disclaimer I am brand new to coding (forgive stupid beginner questions). Please enter

I need help editing java code to compile (located at bottom). Full disclaimer I am brand new to coding (forgive stupid beginner questions). Please enter in a way that I can copy/paste directly and it will compile. Please make corrections or additions (if needed), and please comment in the code for me to better learn what the lines of codes are doing. Below, I have included what the output must look like, below that, the directions for the problem, and at the bottom, the code in which I am trying to get to compile in Jgrasp. I thank you for your assistance in the matter.

image text in transcribed

image text in transcribed

image text in transcribed

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

b. Does senior management trust the team?

Answered: 1 week ago

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago