Question
Need it ASAP please Write a NEW JavaFX program that fulfills the following requirements: Your application will be used to create a grade management system
Write a NEW JavaFX program that fulfills the following requirements: Your application will be used to create a grade management system for students. Your homework will have the following mock-up and requirements: The user should be able to enter a Course Name (e.g. CIS 3368), a Course Grade (i.e. letter grade from A to F), and a Course Code (e.g. 17938). Upon clicking the ADD COURSE button, an object of type needs to be created, and the properties on it set according to the current entries on the UI. Each object also needs to have an Id. After the object is created, it should be added to a list, as seen on the UI. It should display the name of the class, followed by a colon and the class grade. Upon clicking the REMOVE COURSE button, the currently selected class from the list should be removed. Upon clicking the Calculate GPA button, the application should calculate the current overall GPA (average) of all the courses currently visible in the list. Use the following letter grade chart: A 4 B 3 C 2 D 1 F 0 Use JPhoenix controls where possible and applicable. Extra Credit: Implement a notification using the JPhoenix Snackbar control that shows up every time the Calculate GPA button is used. Instead of showing the GPA in the label on the UI, show the current GPA inside the Snackbar Notification.
package sample;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import java.net.URL;
import java.util.ResourceBundle;
public class Controller implements Initializable {
public TextField cName;
public TextField cGrade;
public TextField cCode;
public Button addCourse;
public Button removeCourse;
public ListView courseDisplay;
public Label viewGPA;
public Button calGPA;
private ObservableList display;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
display = courseDisplay.getItems();
addCourse.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent actionEvent) {
info();
}
});
removeCourse.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent actionEvent) {
display.remove(courseDisplay.getSelectionModel().getSelectedItem());
}
});
calGPA.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent actionEvent) {
GPA();
viewGPA.setText(String.valueOf(4));
}
});
}
public void info(){
String courseName = cName.getText();
String courseGrade= cGrade.getText();
String courseCode = cCode.getText();
display.add((Course) (courseName + \":\" +\" \"+ courseGrade));
}
public double GPA(){
return GPA() ;
}
}
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