YavorGrancharov

BonusScore

Dec 15th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class BonusScore {
  3.     public static void main(String[] args) {
  4.         Scanner console = new Scanner(System.in);
  5.         double n = Double.parseDouble(console.nextLine());
  6.         double bonus = 0;
  7.         if (n <= 100) {
  8.             bonus += 5;
  9.         }
  10.         else if (n > 100 && n <= 1000) {
  11.             bonus = ((n * 20) / 100);
  12.         }
  13.         else if (n > 1000) {
  14.             bonus = ((n * 10) / 100);
  15.         }
  16.         if (n % 2 == 0) {
  17.             bonus += 1;
  18.         }
  19.         else if (n % 10 == 5) {
  20.             bonus += 2;
  21.         }
  22.  
  23.         double result = n + bonus;
  24.         System.out.println("Bonus score: " + bonus);
  25.         System.out.println("Total score: " + result);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment