Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.DecimalFormat;
- import java.util.Scanner;
- public class YearlySalary {
- public static void main(String[] args) {
- double tax;
- Decimalformat df = new DecimalFormat("0.00");
- Scanner scan = new Scanner(System.in);
- System.out.println("Enter your yearly Salary -");
- double salary = scan.nextDouble();
- scan.close();;
- if (salary <= 20000.00) {
- System.out.println("Your tax is 0");
- }
- else if (salary > 20000.00) {
- tax = salary * 0.1;
- System.out.println(String.format("Your tax is :" + df.format(tax)));
- }
- else if (salary > 40000.00 && salary <= 60000.00) {
- tax = slary * 0.2;
- System.out.println(String.format("Your tax is :" + df.format(tax)));
- }
- else if (salary > 60000.00) {
- tax = slary * 0.3;
- System.out.println(String.format("Your tax is :" + df.format(tax)));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement