Mohe770

TestAverage

Jan 26th, 2020
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TestAverage
  4. {
  5.     public static void main(String a[])
  6.     {
  7.         double testScore1;
  8.         double testScore2;
  9.         double testScore3;
  10.         double average;
  11.        
  12.         Scanner keyboard = new Scanner(System.in);
  13.         System.out.println("Enter your first test score: ");
  14.         testScore1 = keyboard.nextDouble();
  15.        
  16.         System.out.println("Enter your second test score: ");
  17.         testScore2 = keyboard.nextDouble();
  18.        
  19.         System.out.println("Enter your third test score: ");
  20.         testScore3 = keyboard.nextDouble();
  21.        
  22.         average = (testScore1 + testScore2 + testScore3) / 3.0;
  23.        
  24.         System.out.println("Your average score is: " + average);
  25.         System.exit(0);
  26.     }
  27. }
Add Comment
Please, Sign In to add comment