Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package u5715280;
- import java.util.Scanner;
- public class Question1 {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- int in, tax,income;
- int acc = 0;
- int total = 0;
- while (true) {
- System.out
- .print("Enter your income (input 0 or negative number to terminate) :");
- in = s.nextInt();
- tax = (in * 3) / 100;
- income = in - tax;
- if (in > 0) {
- System.out.println("Tax = " + tax);
- System.out.println("Income (After Tax) = " + income);
- System.out.println("Accumulated Tax Withheld = " + (acc+tax));
- System.out.println("Total Income (After Tax) = "
- + (total + income));
- acc += tax;
- total += income;
- } else {
- System.out.println("Withholding Tax Summary");
- System.out.println("-----------------------");
- System.out.println("Accumulated Tax Withheld = " + (acc+tax));
- System.out.println("Total Income (After Tax) = "
- + (total + income));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement