Hello, I need help making a table based off my tax code I made, the tax code was a little, but I need help with the table part also. The table should look like this: -
Income | Single Married | Joint Married | Separate | Head of house
-
50000 | 9846 | 7296 | 10398 | 8506
-
50050 | 9859 | 7309 | 10411 | 8519
-
........
-
59950 | 12532 | 9982 | 13190 | 11192
-
60000 | 12546 | 9996 | 13205 | 11206
Here is my code: -
//Input: put in the income for the single, married, or head of the household taxes
-
//Process: Using a method to computeing and determining the taxes by less then eual to and by substracting
-
//Output: Display the results
-
//Purpose: The program computes the tax for the taxable income based on the filing status
-
-
import javax.swing.JOptionPane;
-
-
public class ComputeTaxWithMethod {
-
public static void main (String [] args) {
-
// Prompt the user to enter filing status
-
String letters = JOptionPane.showInputDialog(
-
"Enter the filing status:");
-
int status = Integer.parseInt(letters);
-
-
// Prompt the user to enter taxable income
-
String symbol = JOptionPane.showInputDialog(
-
"Enter the taxable income:");
-
double income = Double.parseDouble(symbol);
-
-
//Display the result
-
JOptionPane.showMessageDialog(null, "Tax is " +
-
(int)(computeTax(status, income) * 100) / 100.0);
-
-
System.out.println("income \t\t tax ");
-
System.out.println("________________________");
-
System.out.println(income + "\t\t" + (int)(computeTax(status, income) * 100) / 100.0);
-
-
-
}
-
-
-
public static double computeTax(double income,
-
int r1, int r2, int r3, int r4, int r5) {
-
double tax = 0;
-
-
if (income <= r1)
-
tax = income * 0.10;
-
else if (income <= r2)
-
tax = r1 * 0.10 + (income - r1) * 0.15;
-
else if (income <= r3)
-
tax = r1 * 0.10 + (r2 - r1) * 0.15 + (income - r2) * 0.27;
-
else if (income <= r4)
-
tax = r1 * 0.10 + (r2 - r1) * 0.15 + (r3 - r2) * 0.27 + (income - r4) * 0.35;
-
else
-
tax = r1 * 0.10 + (r2 - r1) * 0.15 + (r3 - r2) * 0.27 + (r4 - r3) * 0.30 + (r5 - r4) * 0.35 + (income - r5) * 0.386;
-
-
return tax;
-
}
-
-
public static double computeTax(int status, double income) {
-
switch (status) {
-
case 0: return //Compute tax for Single
-
computeTax(income, 6000, 27950, 67700, 141250, 307050);
-
case 1: return //Compute tax for married joint
-
computeTax(income, 12000, 46700, 112850, 171950, 307050);
-
case 2: return //Compute tax for married separately
-
computeTax(income, 6000, 23350, 56425, 85975, 153525);
-
case 3: return //Compute tax for head of a house
-
computeTax(income, 10000, 37450, 96700, 156600, 307050);
-
default: return 0;
-
}
-
}
-
}
-
2 3377 - public class test {
-
-
public static void main(String[] args) {
-
// Display the number title
-
-
System.out.println("Taxable Single Married/ Married/ Head of");
-
System.out.print("Income Filer Joint Separate House");
-
-
-
System.out.println("\n----------------------------------------------------------");
-
-
// Display table body
-
double taxableIncome = 50000;
-
while (taxableIncome <= 60000){
-
System.out.printf("%3.0f" + " | ", taxableIncome);
-
-
for (int status = 0; status < 4; status++) {
-
// Display the product and align properly
-
System.out.printf("%11.0f", computetax(status, taxableIncome));
-
}
-
System.out.println("");
-
taxableIncome = taxableIncome + 50;
-
}
-
}
-
-
-
public static double computetax(int status, double taxableIncome) {
-
-
double tax = 0;
-
-
if (status == 0) {
-
if (taxableIncome <= 8350)
-
tax = taxableIncome * 0.10;
-
else if (taxableIncome <= 33950)
-
tax = 8350 * 0.10 + (taxableIncome - 8350) * 0.15;
-
else if (taxableIncome <= 82250)
-
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
-
(taxableIncome - 33950) * 0.25;
-
}
-
else if (status == 1) {
-
if (taxableIncome <= 16700)
-
tax = taxableIncome * 0.10;
-
else if (taxableIncome <= 67900)
-
tax = 16700 * 0.10 + (taxableIncome - 16700) * 0.15;
-
}
-
else if (status == 2) {
-
if (taxableIncome <= 8350)
-
tax = taxableIncome * 0.10;
-
else if (taxableIncome <= 33950)
-
tax = 8350 * 0.10 + (taxableIncome - 8350) * 0.15;
-
else if (taxableIncome <= 68525)
-
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
-
(taxableIncome - 33950) * 0.25;
-
}
-
else if (status == 3) {
-
if (taxableIncome <= 11950)
-
tax = taxableIncome * 0.10;
-
else if (taxableIncome <= 45500)
-
tax = 11950 * 0.10 + (taxableIncome - 11950) * 0.15;
-
else if (taxableIncome <= 117450)
-
tax = 11950 * 0.10 + (45500 - 11950) * 0.15 +
-
(taxableIncome - 45500) * 0.25;
-
}
-
return tax;
-
}
-
-
-
}
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Waqas |
last post by:
Please see the detail of tables with fields in SQL server 2000.
·Table Student .Table Good Qualities
( It is a list of Students) (It is a list of Good Qualities)...
|
by: Toby Austin |
last post by:
I'm trying to replace <table>s with <div>s as much as possible.
However, I can't figure out how to do the following…
<table>
<tr>
<td valign="top" width="100%">some data that will...
|
by: Sami |
last post by:
Please bear with me, and if you answer this question, please do it
step by step. I am new at Access, not at all sophisticated. I am
using Office XP. This will need to be read in Access for...
|
by: Kenjamin.Lafayette |
last post by:
Here is the scenario. I have a list of people, what building they work
in, and on what days.
Is there a way in access to pull up this database and have it make a
list based only on the days,...
|
by: jjturon |
last post by:
Can anyone help me??
I am trying to pass a Select Query variable to a table using Dlookup
and return the value to same select query but to another field.
Ex.
SalesManID ...
|
by: keithb |
last post by:
My ASP.NET 2.0 application has a User Control that contains a DataList that
is unable to get style information from a style located in a css file in the
themes folder. The user control CssClass and...
|
by: kabradley |
last post by:
Alrighty Guys and Gals, I have another question that I hope you all can help me with.
I have a report that uses a cross-tab query as its record source. This cross-tab query is getting all of its...
|
by: HACKhalo2 |
last post by:
Hi. I'm helping a friend of mine develop an online game, which is currently outdated. The person making skins for the site came up with a cool looking NavBar (found at...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |