3-1 AverageScore

Post date: Jan 19, 2014 9:03:51 AM

//averagescore

package averagescore;

import javax.swing.JOptionPane; // Needed for JOptionPane

public class AverageScore {

public static void main(String[] args)

{

// TODO code application logic here

double score1; // To hold score II

double score2; // To hold score 12

double score3; // To hold score 13

double average; // To hold the average score

String input; // To hold the user's input

// Get the first test score.

input =JOptionPane.showInputDialog("Enter score II:");

score1 = Double.parseDouble(input);

// Get the second score.

input = JOptionPane.showInputDialog("Enter score 12:");

score2 = Double.parseDouble(input);

// Get the third test score.

input = JOptionPane.showInputDialog("Enter score 13:");

score3 = Double.parseDouble(input);

// Calculate the average score.

average = (score1 + score2 + score3) / 3.0;

// Display the average score.

JOptionPane.showMessageDialog(null,"The average is " + average);

// If the score was greater than 95, let the user know

// that's a great score,

if (average > 95)

JOptionPane.showMessageDialog(null,"That's a great s c o r e ! " );

System.exit(0);

}

}