Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can you please create a java fx program using scene builder to basically create

ID: 3912887 • Letter: C

Question

Can you please create a java fx program using scene builder to basically create a grade calulator, more information is provided below. THANK YOU IN ADVANCE!!!! PLEASE COMPLETE TODAY IF POSSIBLE!

Calculator.java will be a model class responsible for keeping track of user-entered data related to the CS 3443 course. Therefore, this class must have variables to store the user's grades, including the midterm exam, final exam, team project, 8 lab grades, and 9 quiz grades.

The user will enter their grades into the calculator, as in the following example. Multiple quizzes and labs can be handled by having the user type a comma between each grade. You may change this if you have an idea for a better GUI.


From this view, the user should be able to correct their mistake, and click the button again to compute their grade. They should not have to re-enter any of their grades.
This example shows 2 types of invalid entries: a letter in the Labs entry, and a negative value in the Midterm Exam entry. What other invalid data could the user enter? You must handle any invalid data appropriately - we will test this as part of the "correctness" of this lab.

Home CS 3443 Grade Calculator Labs 100,100,100,90,90,80,100,85 Quizzes100,90,70,100,80,100,100,100,100 Midterm Exam 80 Final Exam 75 Project 90 Compute Final Grade Final Grade: 85.3E

Explanation / Answer

import java.awt.*;


import java.awt.event.*;


import javax.swing.*;


import java.text.*;


import java.awt.Color;


public class GradeCalculator extends JFrame


{


    JLabel gradeJLabel;


JTextField gradeJTextField;


    JLabel clickstartJLabel;


    JButton enterJButton;


    JButton clearJButton;

017     JButton closeJButton;

018

019     JTextField comentaryJTextField;

020

021

022     String testscores;

023     int numberOfScores;

024     double priceValues;

025     int grade;

026     int counter;

027     int gradeAccumulator;

028

029

030     public GradeCalculator()

031     {

032             createUserInterface();

033     }

034

035     public void createUserInterface()

036     {

037         Container contentPane = getContentPane();

038         contentPane.setBackground(Color.WHITE);

039         contentPane.setLayout(null);

040

041         gradeJLabel = new JLabel();

042         gradeJLabel.setBounds(50, 50, 150, 20);

043         gradeJLabel.setFont(new Font("Default", Font.PLAIN, 12));

044         gradeJLabel.setText("Grade:");

045         gradeJLabel.setForeground(Color.BLACK);

046         gradeJLabel.setHorizontalAlignment(JLabel.CENTER);

047         contentPane.add(gradeJLabel);

048

049         gradeJTextField = new JTextField();

050         gradeJTextField.setBounds(200, 50, 50, 20);

051         gradeJTextField.setFont(new Font("Default", Font.PLAIN, 12));

052         gradeJTextField.setHorizontalAlignment(JTextField.CENTER);

053         gradeJTextField.setForeground(Color.BLACK);

054         gradeJTextField.setBackground(Color.WHITE);

055         gradeJTextField.setEditable(false);

056         contentPane.add(gradeJTextField);

057

058         comentaryJTextField = new JTextField();

059         comentaryJTextField.setBounds(200, 100, 50, 20);

060         comentaryJTextField.setFont(new Font("Default", Font.PLAIN, 12));

061         comentaryJTextField.setHorizontalAlignment(JTextField.CENTER);

062         comentaryJTextField.setForeground(Color.BLACK);

063         comentaryJTextField.setBackground(Color.WHITE);

064         comentaryJTextField.setEditable(false);

065         contentPane.add(comentaryJTextField);

066

067         clickstartJLabel = new JLabel();

068         clickstartJLabel.setBounds(100, 200, 150, 20);

069         clickstartJLabel.setFont(new Font("Default", Font.PLAIN, 12));

070         clickstartJLabel.setText("Click Start to Begin!");

071         clickstartJLabel.setForeground(Color.BLACK);

072         clickstartJLabel.setHorizontalAlignment(JLabel.CENTER);

073         contentPane.add(clickstartJLabel);

074

075         enterJButton = new JButton();

076         enterJButton.setBounds(20, 300, 100, 20);

077         enterJButton.setFont(new Font("Default", Font.PLAIN, 12));

078         enterJButton.setText("Enter");

079         enterJButton.setForeground(Color.BLACK);

080         enterJButton.setBackground(Color.WHITE);

081         contentPane.add(enterJButton);

082         enterJButton.addActionListener(

083

084             new ActionListener()

085             {

086                 public void actionPerformed(ActionEvent event)

087                 {

088                     enterJButtonActionPerformed(event);

089                 }

090             }

091         );

092

093         clearJButton = new JButton();

094         clearJButton.setBounds(140, 300, 100, 20);

095         clearJButton.setFont(new Font("Default", Font.PLAIN, 12));

096         clearJButton.setText("Clear");

097         clearJButton.setForeground(Color.BLACK);

098         clearJButton.setBackground(Color.WHITE);

099         contentPane.add(clearJButton);

100         clearJButton.addActionListener(

101

102             new ActionListener()

103             {

104                 public void actionPerformed(ActionEvent event)

105                 {

106                     clearJButtonActionPerformed(event);

107                 }

108             }

109         );

110

111         closeJButton = new JButton();

112         closeJButton.setBounds(260, 300, 100, 20);

113         closeJButton.setFont(new Font("Default", Font.PLAIN, 12));

114         closeJButton.setText("Close");

115         closeJButton.setForeground(Color.BLACK);

116         closeJButton.setBackground(Color.WHITE);

117         contentPane.add(closeJButton);

118         closeJButton.addActionListener(

119

120             new ActionListener()

121             {

122                 public void actionPerformed(ActionEvent event)

123                 {

124                     closeJButtonActionPerformed(event);

125                 }

126             }

127         );

128

129

130         setTitle("Grade Calculator");

131         setSize(400, 400);

132         setVisible(true);

133     }

134

135     /* main method */

136     public static void main(String[] args)

137     {

138             GradeCalculator application = new GradeCalculator();

139             application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

140     }

141

142     public void enterJButtonActionPerformed(ActionEvent event)

143     {

144         getnumberoftests();

145     }

146

147     public void getnumberoftests()

148         {

149             testscores = JOptionPane.showInputDialog("Enter Number of Grades");

150             numberOfScores = Integer.parseInt(testscores);

151             gettestscores();

152     }

153

154     public void gettestscores()

155     {

156         for(counter = 0; counter < numberOfScores; counter++)

157         {

158             testscores = JOptionPane.showInputDialog("Enter Scores");

159             priceValues = Integer.parseInt(testscores);

160             gradeAccumulator += priceValues;

161         }

162

163         calculateAverage();

164     }

165

166     public void calculateAverage()

167     {

168                 grade = gradeAccumulator / numberOfScores;

169     }

170

171

172      public int getgrade() {

173             return gradeAccumulator / numberOfScores;

174     }

175

176     public void checkgrade()

177     {

178

179     if(grade < 64)

180             {

181                 comentaryJTextField.setText("F");

182             }

183              else if(grade < 69)

184             {

185                 comentaryJTextField.setText("D");

186

187             }

188              else if(grade < 79)

189

190             {

191                 comentaryJTextField.setText("C");

192

193             }

194             else if(grade < 89)

195

196             {

197                 comentaryJTextField.setText("B");

198

199             }

200

201             else {

202

203                 comentaryJTextField.setText("A");

204

205             }

206

207     }

208

209     public void clearJButtonActionPerformed(ActionEvent event)

210     {

211         gradeJTextField.setText("");

212     }

213

214     public void closeJButtonActionPerformed(ActionEvent event)

215     {

216         GradeCalculator.this.dispose();

217     }

218 }