Question
1 Description of the Program In this assignment, you are asked to implement a graphical application that simulates a simplified version of DegreeWorks. Briefly, this
1 Description of the Program
In this assignment, you are asked to implement a graphical application that simulates a simplified version of DegreeWorks. Briefly, this GUI will take the inputs (i.e., course information), store them in an array list, and display course information in the output area. Figure 1 shows the layout of the DegreeWorks GUI.
2 Details of the program
you should have three Java files:
1. DegreeWorksFrame class that extends JFrame class (The main part of your program).
2. DegreeWorksViewer class, which contains the main method where a DegreeWorks object will be created, and the GUI will pop up (Suggested frame width of 450, and frame height of 400).
3. Course class, which is the class that models the Course objects (This file will be given to you)
In your DegreeWorksFrame class file, you should have the followings:
Input area:
A text label and a text field (suggested width of 30) for course code
A text label and a text field (suggested width of 30) for course name;
A text label and a text field (suggested width of 30) for course credit;
A text label and a text field (suggested width of 30) for course grade;
Buttons:
One button (AddCourse) used for adding a course into your course list, and append this course in the output area;
One button (CalculateGPA) used for calculating the overall GPA for all the courses in the course list, and append the GPA in the output area.
One button (ResetInput) used for resetting all input fields;
One button (ResetOutput) used for resetting the output;
Output area:
One text area (suggested row of 10 and column of 35) that displays course information or GPA; You may initialize the text area by including the headings (Code, Name, Credit and Grade).
A scrollpane that includes the output text area;
One ArrayList instance variable (e.g., courseList) to store the courses you add;
Four inner ActionListener classes, with each of them implements its method of actionPerformed. Specifically,
AddCourseListener: read the inputs and create a course object, add the course object into the courseList, and append this into the output area;
CalGPAListener: read all course credits and grades from the courseList, add them up and compute the overall GPA. You are assuming that A is 4, B is 3, C is 2, D is 1, and E is 0. GP A = Sum(creditpoint)/totalCredits. For instance (Figure 1), you have taken 3 courses: 130 (3 credits, grade of A), 131 ( 3 credits, grade of B), and 370 (4 credits, grade of B), then your GPA = (3*4+3*3+4*3)/(3+3+4) = 3.3.
ResetInputListener: reset all input fields;
ResetOutputListener: reset output area.
This is what I have so far:
public class Course { private String code; private String name; private int credit; private String grade;
public Course() { code=""; name=""; credit=0; grade=""; } /** Create a course with a given name, credit and grade. @param name the name @param credit the credit @param grade the grade */ public Course(String code, String name, int credit, String grade ) { this.code = code; this.name = name; this.credit = credit; this.grade=grade; }
/** Get the course code. @return the code */ public String getCode() { return code; } /** Change the course code. @param code the code */ public void setCode(String code) { this.code = code; } /** Get the name. @return the name */ public String getName() { return name; } /** Change the name. @param name the name */ public void setName(String name) { this.name = name; } /** Get the credit. @return the credit */ public int getCredit() { return credit; } /** Change the credit. @param credit the credit */ public void setCredit(int credit) { this.credit=credit; }
/** Get the grade. @return the grade */ public String getGrade() { return grade; } /** Change the grade. @param grade the grade */ public void setGrade(String grade) { this.grade = grade; } /** Convert course to string form. */ public String toString() { return " " + code + "\t" + name + "\t" + credit + "\t" + grade; } }
My DegreeWorks Frame Course Code: CPSC370 Course Name: Cryptography Course Credit: 4 Course Grade: B AddCourse Calculate GPA Reset Input Reset Output Name Credit Grade Code CPSC130 Java CPSC131 Javal CPSC370 Cryptography 4 GPA: 3.3
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