/** 9/12/2018
  * This program introduces the Scanner class from the Java API.
  * The purpose is to get data as the program is running. 
  */
import java.util.Scanner;  // bring in Scanner class

public class UserInput
{
/** This main method will read in the values of 2 test grades 
  * and then calculate and print the average.
  */
 public static void main(String[] args) 
 {
  int test1, test2;
  Scanner keyboard = new Scanner(System.in); // declare a Scanner object for use in reading
  System.out.println("Enter name: ");
  String name;
  name = keyboard.nextLine();
  // prompt the user
  System.out.println("Enter 2 test grades for " + name +':');
  // read in data
  test1 = keyboard.nextInt();
  test2 = keyboard.nextInt();
  
  double avg = (double) Math.addExact(test1, test2)/2; // method call is embedded in an expr
  System.out.println("2 test marks: " + test1 + " " +
                     test2 + " Test average: " + avg);
 }
}
