Advertisement
desislava_topuzakova

06.BonusScore

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