Advertisement
remote87

TaxCalculator

Nov 23rd, 2020
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Scanner;
  3. // винаги използвайте клас Main, инак ще получите грешка при компилиране!
  4. public class Main {
  5.   public static void main(String[] args) {
  6.     // напишете вашият код тук
  7.     Scanner sc = new Scanner(System.in);
  8.     double salary = Double.parseDouble(sc.nextLine());
  9.     double taxes = 0;
  10.     if(salary >= 60000){
  11.         taxes += (salary - 60000) * 0.3 + 6000;
  12.  
  13.     }else if((salary >= 40001) &&(salary <= 59999)){
  14.         taxes += (salary - 40000) * 0.2 + 2000;
  15.     }else if((salary >= 20001) && (salary <= 40000)){
  16.         taxes += (salary - 20000) * 0.1;
  17.     }
  18.     System.out.printf("%.2f", taxes);
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement