Advertisement
476179

MultipleConditionalStatments - Java2

Oct 22nd, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package lesson;
  2.  
  3.  
  4.  
  5. public class MultipleConditionalStatments
  6. {
  7.  
  8. public static void main(String[] args)
  9. {
  10. //sample 1
  11. //program checks if saleAmt>50k, assigns 500.00 to bonus, 0.12 to commission and 1 to daysOff
  12. //
  13. double salesAmt = 55_000, bonus = 0, commission = 0;
  14. int daysOff = 0;
  15.  
  16. if (salesAmt > 50_000);
  17. {
  18. bonus = bonus + 500.00;
  19. commission = commission + .12;
  20. daysOff += 1; // same as: daysOff = daysOff +1;
  21. }
  22.  
  23.  
  24.  
  25.  
  26. //sample 2
  27. int avg = 96;
  28. boolean high = false;
  29. if (avg > 95)
  30. {
  31. high = true;
  32. }
  33. if (high) // if true it'll execute if not it wont
  34. {
  35. System.out.println("thats a high score");
  36. }
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement