Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Code runs, but not everything prints.

$
0
0
My code runs without error but only the income and marital status are printed.

import java.util.*;
public class TaxSystem3 {
    
    public static void main(String[] args) {
    String status,m = null,s = null;
         int income;
// Prompt user to enter if married or single
    Scanner in = new Scanner (System.in);
    System.out.print("Enter M if married, or S if single: ");
    status = in.next();
    System.out.println();

//promt the user to enter income

   
    System.out.print("Enter income:");
    income = in.nextInt();
    System.out.println();
   
 // calculate amount taxed
    if ( status.equals(m)) {

       if (income <=8000)
            {
            System.out.println("Tax Paid: " +income * 0.1);
            }
            else if (income <=32000)
            {
            System.out.println("Tax Paid: " +800 * 0.02);
            }
            else if (income >32000);
            {
            System.out.println("Tax Paid: " +4400  * 0.03);
            }

if (status.equals(s)) {
    
      if  (income <=16000)
            {
            System.out.println("Tax Paid: " +income * 0.1);
            }
            else if (income <=64000)
            {
            System.out.println("Tax Paid: " +1600 * 0.15);
            }
            else if (income >64000)
            {
            System.out.println("Tax Paid: " +8800 * 0.25);
            }
            else
            {
            System.out.println("invalid entry!");
            }
        }
}
}//main


Viewing all articles
Browse latest Browse all 51036

Trending Articles