Question
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.
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 } 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 public Student(String firstName, String lastName, String termAndYear, int noOfClasses, ArrayList 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 ------------------------------------------------------------ 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started