Back to Examples
package edu.iuk.Taxes;

import javax.swing.JOptionPane;

public class Taxes {

  public static void main(String[] args) {

    //Jacob Morris
    double income;
    double taxes;

    //gets user’s annual income
    income= Double.parseDouble(JOptionPane.showInputDialog(“Please enter your annual income.”));

    if(income <= 10000){

      //Computes taxes if annual income is less than or equal to 10,000
      taxes = income * .02;

    } else if(income >25000){

      //Computes taxes if annual income is greater than 25,000
      taxes = income * .03;

    } else{

      //Computes taxes if annual income is somewhere in between 10,000 and 25,000
      taxes = (10000 * .02) + ((arubIncome – 10000) * .03);

    }

    //rounds taxes to two decimal places
    taxes =(double)Math.round(taxes * 100) / 100;

    //tells user how much he must pay in taxes this year
    JOptionPane.showMessageDialog(null, “You are supposed to pay $” + taxes + ” this year.”);

  }

}
Back to Examples

Startup Discount
Small Business?
Contact us for an Enormous Discount!