Advertisement
ilian_test

Bonus Score

Nov 13th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.15 KB | None | 0 0
  1. /**
  2.  *
  3.  */
  4. /**
  5.  * @author Ilian Dimitrov
  6.  *
  7.  */
  8. package confSS;
  9.  
  10. import java.util.Scanner;
  11.  
  12. public class math {
  13.  
  14.     private static Scanner input;
  15.     private static double firstPrecent;
  16.     private static double secoundPrecent;
  17.     private static int even;
  18.     private static int Under;
  19.     private static int lastDigitAdd;
  20.  
  21.     public static void main(String[] args) {
  22.         input = new Scanner(System.in);
  23.  
  24.         int points = input.nextInt();
  25.         int lastDigit = points % 10;
  26.         setEven(1);
  27.         setUnder(5);
  28.         setLastDigitAdd(2);
  29.         setFirstPrecent((points * 20 / 100) + points);
  30.         setSecoundPrecent(((points * 10 / 100) + points));
  31.        
  32.        
  33.         if (points <= 100) {
  34.             if (points % 2 == 0) {
  35.                 System.out.println(points + Under + even);
  36.             } else if (lastDigit == 5) {
  37.                 System.out.println(points + Under + lastDigitAdd);
  38.             } else {
  39.                 System.out.println(points + Under);
  40.             }
  41.         } else if (points > 100 && points <= 1000) {
  42.             if (points % 2 == 0) {
  43.                 System.out.println(firstPrecent + even);
  44.             } else if (lastDigit == 5) {
  45.                 System.out.println(firstPrecent + lastDigitAdd);
  46.             } else {
  47.                 System.out.println(firstPrecent);
  48.             }
  49.         } else if (points > 1000) {
  50.             if (points % 2 == 0) {
  51.                 System.out.println(secoundPrecent + even);
  52.             } else if (lastDigit == 5) {
  53.                 System.out.println(secoundPrecent + lastDigitAdd);
  54.             } else {
  55.                 System.out.println(secoundPrecent);
  56.             }
  57.         }
  58.     }
  59.  
  60.     public static double getFirstPrecent() {
  61.         return firstPrecent;
  62.     }
  63.  
  64.     public static void setFirstPrecent(double firstPrecent) {
  65.         math.firstPrecent = firstPrecent;
  66.     }
  67.  
  68.     public static double getSecoundPrecent() {
  69.         return secoundPrecent;
  70.     }
  71.  
  72.     public static void setSecoundPrecent(double secoundPrecent) {
  73.         math.secoundPrecent = secoundPrecent;
  74.     }
  75.  
  76.     public static int getEven() {
  77.         return even;
  78.     }
  79.  
  80.     public static void setEven(int even) {
  81.         math.even = even;
  82.     }
  83.  
  84.     public static int getUnder() {
  85.         return Under;
  86.     }
  87.  
  88.     public static void setUnder(int under) {
  89.         math.Under = under;
  90.     }
  91.  
  92.     public static int getLastDigitAdd() {
  93.         return lastDigitAdd;
  94.     }
  95.  
  96.     public static void setLastDigitAdd(int lastDigitAdd) {
  97.         math.lastDigitAdd = lastDigitAdd;
  98.     }
  99.  
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement