mmayoub

Ex03B, 24.04.2021

Apr 25th, 2021
618
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // 24.04.2021
  2. import java.util.Scanner;
  3.  
  4. public class Ex03B {
  5.  
  6.     public static void main(String[] args) {
  7.         // TODO Auto-generated method stub
  8.  
  9.         Scanner in = new Scanner(System.in);
  10.  
  11.         // double sa3at ;
  12.         // double ajrSa3a;
  13.         // double ajrShahri;
  14.  
  15.         double sa3at, ajrSa3a, ajrShahri;
  16.         double mefra3a;
  17.         System.out.print("number of hours: ");
  18.         sa3at = in.nextDouble();
  19.  
  20.         System.out.print("price for hour: ");
  21.         ajrSa3a = in.nextDouble();
  22.  
  23.         System.out.print("mefra3a: ");
  24.         mefra3a = in.nextDouble();
  25.  
  26.         // שעות נוספות
  27.         if (sa3at > 160) {
  28.             double overTime = sa3at - 160;
  29.             double overPrice = 1.25 * ajrSa3a;
  30.             double overSalary = overTime * overPrice;
  31.  
  32.             ajrShahri = 160 * ajrSa3a + overSalary;
  33.         } else {
  34.             ajrShahri = sa3at * ajrSa3a - mefra3a;
  35.         }
  36.  
  37.         System.out.println("Toatal salary = " + ajrShahri);
  38.  
  39.         in.close();
  40.     }
  41. }
  42.  
RAW Paste Data