-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScoreKeeper.java
39 lines (33 loc) · 1004 Bytes
/
ScoreKeeper.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
Name: Gil
Date: January 23, 2024
*/
import java.util.Scanner;
public class ScoreKeeper
{
public static void main(String[] args)
{
double
score1,
score2,
score3,
averageScore;
try (Scanner keyboard = new Scanner(System.in))
{
System.out.println("This program averages 3 scores.");
System.out.print("Enter score #1: ");
score1 = keyboard.nextDouble();
System.out.print("Enter score #2: ");
score2 = keyboard.nextDouble();
System.out.print("Enter score #3: ");
score3 = keyboard.nextDouble();
}
averageScore = (score1 + score2 + score3) / 3.0;
if (averageScore > 95)
{
System.out.println("That's a great score!");
System.out.println("You are smort!");
}
System.out.println("The average is " + String.format("%.2f", averageScore));
}
}