/*--------------------------------------------------
// Name:
// Filename: Lab01.java
// Specification: This file lets a user input three test grades to find the
average.
// For: CSE 110 - Lab #1
// Time Spent: 1 hour */
import java.util.Scanner;
public class Lab01
{
public static void main(String[] args)
{
double test1 = 0;
double test2;
double test3;
final double NUM_TESTS = 3;
Scanner keyboard = new Scanner(System.in);
//This asks for test 1 score, and outputs it.
System.out.println("Please input test 1 score:");
test1 = keyboard.nextDouble();
System.out.println("Your test 1 is " + test1);
// This asks for test 2 score, and outputs it.
System.out.println("Please input test 2 score:");
test2 = keyboard.nextDouble();
System.out.println("Your test 2 is " + test2);
//This asks for test 3 score, and outputs it.
System.out.println("Please input test 3 score:");
test3 = keyboard.nextDouble();
System.out.println("Your test 3 is " + test3);
//Calculates and outputs average of 3 tests.
double avg;
avg = (test1 + test2 + test3) / NUM_TESTS;
System.out.println("Your average is " + avg);
//Closed scanner.
keyboard.close();
}
}
Powered by TCPDF (www.tcpdf.org)