Advertisement
StefanTobler

Lesson 12 Activity 1

Sep 25th, 2016
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. /*
  2.  * Lesson 12 Coding Activity 1
  3.  * Write a program to input three integers.
  4.  * Test if the average is greater than or equal to 89.5.
  5.  * If so, print out the phrase "ABOVE AVERAGE" (without the quotes).
  6.  */
  7.  
  8.  
  9. import java.util.Scanner;
  10.  
  11. class Lesson_12_Activity_One {
  12.     public static void main(String[] args)
  13.      {
  14.        Scanner scan = new Scanner(System.in);
  15.        
  16.        System.out.println("Enter 3 intergers: ");
  17.        
  18.        int x = scan.nextInt();
  19.        int y = scan.nextInt();
  20.        int z = scan.nextInt();
  21.        double avg = ((x + y + z)/3.0);
  22.        System.out.println(avg);
  23.        if(avg >= 89.5)
  24.        {  
  25.          System.out.println("ABOVE AVERAGE");
  26.        }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement