Advertisement
Strade351

Task 5.1.6

Jul 9th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. /**
  2.  * Created by Anatoliy on 10.07.2016.
  3.  * Task 5.1.6
  4.  */
  5. import java.util.Scanner;
  6.  
  7. public class Task9 {
  8.     public static void main(String[] args) {
  9.         double average;
  10.         int daysAbsent;
  11.         boolean exempt = false;
  12.         Scanner reader = new Scanner(System.in);
  13.         System.out.println("This program will determine if you can get out of the final exam.");
  14.         System.out.println("Please answer the following questions.");
  15.         System.out.println("What is your average in the class?");
  16.         average = reader.nextDouble();
  17.         System.out.println("How class lectures have you missed?");
  18.         daysAbsent = reader.nextInt();
  19.         if ((average >= 90 && daysAbsent <= 3) || (average >= 80 && daysAbsent <= 0)) {
  20.             exempt = true;
  21.             System.out.println("Congratulations! You are exempt from the final exam.");
  22.         }
  23.         else
  24.         {
  25.             exempt = false;
  26.             System.out.println("You are not exempt from the final exam.");
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement