QuestionQuestion

Transcribed TextTranscribed Text

Instructions This programming project involves writing a program to manage a student database. The interface to the program should be a GUI that looks similar to the following: E Project 4 Id: Name: Major: Choose Selection: Insert Insert Process Request Delete Find Update A combo box should allow the user to select one of the four database actions shown. The database should be implemented as a HashMap, with the ID field as the key and a student record consisting of a name and major as the value. The operation should be performed when the user clicks the Process Request button. If the user attempts to insert a key that is already in the database an error message should be displayed using a JOptionPane message dialog box. If the user attempts to delete, find or update a record that is not in the database, a message should also be displayed. After each successful operation is completed a JOptionPane window should be displayed confirming the success. In the case of a successful Find request, a window should pop up containing the student's ID, name, major and current GPA. When the user selects the Update request, the following JOptionPane windows should be displayed to gather information about a course that has just been completed: ? Choose grade: x A A Choose credits: B 3 C 3 D 6 F This program must consist of two classes. The first class should define the GUI and handle the database interactions. It should be hand-coded and not generated by a GUI generator. The second class named Student, should define the student record. It must have instance variables for the student name, major and two variables that are used to compute the GPA. A variable that contains the total number of credits completed and a second variable that contains the total quality points, which are the numeric value of the grade received in a course times the number of credit hours. It should not contain the student ID. The class should have the following three methods: 1. A constructor that is used when new student records are created. It should accept the name and major as parameters and initialize the fields that are used to compute the GPA to zero. 2. The second method courseCompleted should accept the course grade and credit hours and update the variables used to compute the GPA. It will be called when an Update request is made. 3. The third method should override toString and return a labeled string containing the student name, major and GPA. Be sure that all instance and class variables are declared as private. Also any exceptions thrown by nonnumeric inputs should be properly handled. Finally when a student has not yet completed any course, the GPA should be displayed as 4.0.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.text.DecimalFormat;
import javax.swing.JOptionPane;

public class Student {
    private String name;
    private String major;
    private int credit; // the total number of credits completed
    private double points; // the total quality points,
    // which are the numeric value of the grade received
    // in a course times the number of credit hours

    /**
    * constructor
    * @param name
    * @param major
    */
    public Student(String name, String major) {
       this.name = name;
       this.major = major;
       this.credit = 0;
       this.points = 0;
    }
   
    /**
    *
    * @param credit
    * @param grade
    * @return true when the update is success
    *          false in other cases
    */
    public boolean courseCompleted(String credit, String grade){
       try {
            int hours = Integer.parseInt(credit);
            char c = grade.charAt(0);
            double point = 0;
            switch(c){...
$70.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats