Advertisement
mmayoub

Ex01, 01.05.2021

May 1st, 2021
1,099
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. // 01.05.2021
  2. import java.util.Scanner;
  3.  
  4. public class Ex01 {
  5.  
  6.     public static void main(String[] args) {
  7.         // TODO Auto-generated method stub
  8.         Scanner in = new Scanner(System.in);
  9.        
  10.         double a, b;
  11.         double avg;
  12.  
  13.         // input data from user
  14.         System.out.print("Enter semester 1 grade: ");
  15.         a = in.nextDouble();
  16.         System.out.print("Enter semester 2 grade: ");
  17.         b = in.nextDouble();
  18.  
  19.         // part a
  20.         avg = (a+b) /2;
  21.         System.out.println("average = " + avg);
  22.        
  23.         // part b
  24.         if (avg>93) {
  25.             System.out.println("מגיע לך תעודת הצטיינות");
  26.         }
  27.        
  28.         in.close();
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement