Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package conditionalStatements;
- import java.util.Scanner;
- public class P02BonusScore {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num = Integer.parseInt(scanner.nextLine());
- double bonus = 0;
- if (num <= 100) {
- bonus = 5;
- } else if (num <= 1000) {
- bonus = num * 0.20;
- } else {
- bonus = num * 0.10;
- }
- if (num % 2 == 0) {
- bonus = bonus + 1;
- }
- if (num % 10 == 5) {
- bonus = bonus + 2;
- }
- System.out.printf("%.1f%n", bonus);
- System.out.printf("%.1f", num + bonus);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement