Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java - Test Scores

josh2013
josh2013 


Operation •The user enters test scores one at a time and then clicks the Enter Score button. •For each entered score, the application adds one to the number of scores, calculates the average score, and determines what the best score is so far. Then, it displays the number of scores, average score, and best score in the three disabled text fields. •The user can click the Clear button to reset everything to zero. •When the user closes the frame or clicks the Close button, the application exits. Specifications •The average score is the sum of all scores divided by the number of scores. •Assume valid data is entered. Hint •If you have trouble getting the labels and text fields to line up properly, try adjusting the frame size. When you use the Flow layout manager, the width of the frame affects how components you add to the frame are lined up. Enhancement •Add data validation by catching the exception that's thrown when the user enters invalid data. Attachments Tags Clarifications

Answers

Java - Test Scores - Solution

dickersonka
dickersonka 



Attached is the solution the Java - Test Scores assignment including source, comments, and enhancements. Attachments
TestScores.zip (20 K) Download
Preview
new ArrayList<Double>(); /** * Create panel */ public TestScoresPanel() { setLayout(new BorderLayout()); JPanel displayPanel = new JPanel(); displayPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); //Enter score lblScore = new JLabel("Test score:"); displayPanel.add(lblScore); tbScore = new JTextField(10); displayPanel.add(tbScore);

Preview

Screenshots
Screenshot
Purchase Answer