BubaLazi

p06_BonusPoints

Mar 12th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.lang.String;
  3.  
  4. public class BonusPoints {
  5.     public static void main(String[] args) {
  6.         Scanner console = new Scanner(System.in);
  7.  
  8.         int num = Integer.parseInt(console.nextLine());
  9.  
  10.         double bonus1 =0;
  11.         double bonus2 =0;
  12.         boolean isEven = num % 2 == 0;
  13.  
  14.         if(num <= 100){
  15.             bonus1 = 5;
  16.         }else if( num >100 && num <= 1000){
  17.             bonus1 = num * 0.20;
  18.         }else if( num > 1000){
  19.             bonus1 = num * 0.10;
  20.         }
  21.  
  22.         if(isEven){
  23.             bonus2 = 1;
  24.         }else if(num % 10 == 5){
  25.             bonus2 = 2;
  26.         }
  27.  
  28.         double totalBonus = bonus1 + bonus2;
  29.  
  30.         System.out.println(totalBonus);
  31.         System.out.println(totalBonus + num);
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment