Advertisement
veronikaaa86

02. Bonus Score

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