Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Bonus {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int number = scan.nextInt();
- int total = calculatingBonus(number);
- System.out.println(String.format("Your number without bonus: %d", number));
- System.out.println(String.format("Your number with bonus: %d", total));
- }
- public static int calculatingBonus(int number){
- int bonus = 0;
- int total = 0;
- if(number > 0) {
- if (number < 100) {
- bonus += 5;
- } else if (number < 1000) {
- bonus += number * 0.2;
- } else {
- bonus += number * 0.1;
- }
- }
- total = bonus + number;
- return total;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement