Advertisement
MladenKarachanov

BonusScore

Jan 17th, 2024
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. package firstStepsInCoding.MoreExercises;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class BonusScore {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int num = Integer.parseInt(scanner.nextLine());
  9.         double bonus = 0;
  10.  
  11.         if (num <= 100) {
  12.             bonus = 5;
  13.  
  14.         } else if (num > 1000) {
  15.             bonus = num * 0.1;
  16.  
  17.         } else {
  18.             bonus = num * 0.2;
  19.         }
  20.         if (num % 2 == 0) {
  21.             bonus = bonus + 1;
  22.  
  23.         } else if (num % 10 == 5) {
  24.             bonus = bonus + 2;
  25.         }
  26.             System.out.println(bonus);
  27.             System.out.println(num + bonus);
  28.         }
  29.     }
  30.  
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement