Note that there are some explanatory texts on larger screens.

plurals
  1. POMarks Program Calculations?
    primarykey
    data
    text
    <p>I have to make a marks program that displays a set of marks that a user enters and some calculations (average, maximum, minimum, range, etc.). It should also be able to sort the marks in ascending order. I managed (with help) to display the marks and sort them but I cannot get the program to do the calculations and display them. This is all the code I have so far: </p> <pre><code> ArrayList &lt;Integer&gt; marks = new ArrayList(); private void addButtonActionPerformed(java.awt.event.ActionEvent evt) { Collections.addAll(marks, (Integer.parseInt(markInput.getText()))); StringBuilder text = new StringBuilder(); for (Integer mark: marks) { text.append(mark.toString()).append('\n'); } markdisplayTextArea.setText(text.toString()); } private void sortButtonActionPerformed(java.awt.event.ActionEvent evt) { Collections.sort(marks); StringBuilder text = new StringBuilder(); for (Integer mark: marks) { text.append(mark.toString()).append('\n'); } markdisplayTextArea.setText(text.toString()); } private void analyzeButtonActionPerformed(java.awt.event.ActionEvent evt) { analyzeTextArea.setText("Class average:" +); analyzeTextArea.setText("Maximum mark:" +); analyzeTextArea.setText("Minimum mark:" +); analyzeTextArea.setText("Range of marks:" +); } </code></pre> <p>The calculations must be displayed in a <code>TextArea</code> when the <code>"analyze"</code> button is pressed. I currently have no idea of how to go about doing the calculations or displaying them. Any guidance would be appreciated. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload