galinyotsev123

ProgBasics03Conditional-Statements-Y02BonusScore

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