1 / 1100%
public static void main(String[] args)
{
int test1, test2, test3;
double average;
final double NUM_TESTS = 3;
Scanner in = new Scanner(System.in);
System.out.print("Enter the score on the first test: ");
test1 = in.nextInt();
System.out.print("Enter the score on the second test: ");
test2 = in.nextInt();
System.out.print("Enter the score on the third test: ");
test3 = in.nextInt();
average = (test1 + test2 + test3) / NUM_TESTS;
DecimalFormat fmt = new DecimalFormat("0.####");
System.out.println("Your average score is: "+ fmt.format(average));
}//end main method
}//end Lab1 class
Powered by TCPDF (www.tcpdf.org)
/*--------------------------------------------
Lab1
// AUTHOR:
// FILENAME:
// SPECIFICATION: computes the average of three test scores
// FOR: CSE 110- Lab#1
// TIME SPENT: 30 minutes
//------------------------------------------*/
import java.util.Scanner;
import java.text.DecimalFormat;
public class Lab1
{
Students also viewed