directory structure change, organize by class number as opposed to mod number

Signed-off-by: Amrit Panesar <apanesar@4195tech.com>
This commit is contained in:
Amrit Panesar committed 2015-04-12 23:49:33 -07:00
1 parent 2a3d6fc042
commit 8683384387
480 files changed
+7

No files matched your search

Binary file not shown.
Binary file not shown.
+60
View File
@@ -0,0 +1,60 @@
/******************************************************************************
* Project: Project 4a *
* Class Name: Project4a *
* Author: Amrit Panesar -ASP ,o/ *
* Last Edited: 09/10/2012 *
* Hours: 0.20 Hours *
* Purpose: Evaluate the input of a char representing the taxpayer's *
* filing status and reporting weather the taxpayer will be *
* taxed as a single or married person. *
* *
******************************************************************************/
import java.util.*;
public class Project4a
{
public static void main(String[] args) // main
{
System.out.println("Are you (M)arried (H)ead of Household or "
+ "(S)ingle?");
Scanner console = new Scanner(System.in);
String sInput = console.next();
char cStatus = sInput.toLowerCase().charAt(0);
if (cStatus != 'm' && cStatus != 'h' && cStatus != 's')
{
System.out.println("Invalid input \""+cStatus+"\", please re-run the program");
System.exit(0);
}
if (cStatus != 'm')
System.out.println("You are filing as Single");
else
System.out.println("You are filing as Married");
}
}
/* Output:
E:\programs\Mod1\Project 4>java Project4a
Are you (M)arried (H)ead of Household or (S)ingle?
m
You are filing as Married
E:\programs\Mod1\Project 4>java Project4a
Are you (M)arried (H)ead of Household or (S)ingle?
h
You are filing as Single
E:\programs\Mod1\Project 4>java Project4a
Are you (M)arried (H)ead of Household or (S)ingle?
s
You are filing as Single
E:\programs\Mod1\Project 4>java Project4a
Are you (M)arried (H)ead of Household or (S)ingle?
4
Invalid input "4", please re-run the program
*/
Binary file not shown.
+60
View File
@@ -0,0 +1,60 @@
/******************************************************************************
* Project: Project 4b *
* Class Name: Project4b *
* Author: Amrit Panesar -ASP ,o/ *
* Last Edited: 09/10/2012 *
* Hours: 0.20 Hours *
* Purpose: Evaluate the input of a char representing the taxpayer's *
* filing status and reporting weather the taxpayer will be *
* taxed as a single or married person. *
* *
******************************************************************************/
import java.util.*;
public class Project4b
{
public static void main(String[] args) // main
{
System.out.println("Are you (M)arried (H)ead of Household (E)xempt "
+ "or (S)ingle?");
Scanner console = new Scanner(System.in);
String sInput = console.next();
char cStatus = sInput.toLowerCase().charAt(0);
if (cStatus != 'm' && cStatus != 'h' && cStatus != 's')
{
System.out.println("You have elected for exempt status");
System.exit(0);
}
if (cStatus == 'm')
System.out.println("You are filing as Married");
else if (cStatus == 's')
System.out.println("You are filing as Single");
else if (cStatus == 'h')
System.out.println("You are filing as Head of Household");
}
}
/* output:
E:\programs\Mod1\Project4>java Project4b
Are you (M)arried (H)ead of Household (E)xempt or (S)ingle?
m
You are filing as Married
E:\programs\Mod1\Project4>java Project4b
Are you (M)arried (H)ead of Household (E)xempt or (S)ingle?
head of household
You are filing as Head of Household
E:\programs\Mod1\Project4>java Project4b
Are you (M)arried (H)ead of Household (E)xempt or (S)ingle?
s
You are filing as Single
E:\programs\Mod1\Project4>java Project4b
Are you (M)arried (H)ead of Household (E)xempt or (S)ingle?
4
You have elected for exempt status
*/
Binary file not shown.
+96
View File
@@ -0,0 +1,96 @@
/******************************************************************************
* Project: Project 4c *
* Class Name: Project4c *
* Author: Amrit Panesar -ASP ,o/ *
* Last Edited: 09/10/2012 *
* Hours: 0.20 Hours *
* Purpose: Evaluate the input of a char representing the taxpayer's *
* filing status and reporting weather the taxpayer will be *
* taxed as a single or married person. *
* *
******************************************************************************/
import java.util.*;
public class Project4c
{
public static void main(String[] args) // main
{
Scanner console = new Scanner (System.in);
System.out.println("How many withholdings do you have?");
int iWHold = 0;
String input = console.next();
try
{
iWHold = Integer.parseInt(input);
}
catch (NumberFormatException nfe)
{
System.out.println("We're sorry, \""+input+"\" was an invalid "
+ "input. Please re-run the program.");
System.exit(0);
}
//input has been sanitized.
int iHVal = 0;
switch (iWHold)
{
case 1:
iHVal = 42;
break;
case 2:
iHVal = 83;
break;
case 3:
iHVal = 125;
break;
case 4:
iHVal = 167;
break;
case 5:
iHVal = 208;
break;
case 6:
iHVal = 250;
break;
case 7:
iHVal = 292;
break;
case 8:
iHVal = 333;
break;
case 9:
iHVal = 375;
break;
case 10:
iHVal = 417;
break;
default:
iHVal = iWHold * 42;
break;
}
System.out.println (iWHold + " withholding allowances provides an "
+ "estimated deduction of: $" +iHVal);
}
}
/*output:
E:\programs\Mod1\Project4>java Project4c
How many withholdings do you have?
1
1 withholding allowances provides an estimated deduction of: $42
E:\programs\Mod1\Project4>java Project4c
How many withholdings do you have?
1024
1024 withholding allowances provides an estimated deduction of: $43008
E:\programs\Mod1\Project4>java Project4c
How many withholdings do you have?
5
5 withholding allowances provides an estimated deduction of: $208
*/
Binary file not shown.
+129
View File
@@ -0,0 +1,129 @@
/******************************************************************************
* Project: Project 4d *
* Class Name: Project4d *
* Author: Amrit Panesar -ASP ,o/ *
* Last Edited: 09/10/2012 *
* Hours: 0.20 Hours *
* Purpose: Evaluate the input of a char representing the taxpayer's *
* filing status and reporting weather the taxpayer will be *
* taxed as a single or married person. *
* *
******************************************************************************/
import java.util.*;
public class Project4d
{
public static void main(String[] args) // main
{
Scanner console = new Scanner (System.in);
System.out.println("What is your gross pay?");
double dGross = 0;
String input = console.next();
try
{
dGross = Double.parseDouble(input);k
}
catch (NumberFormatException nfe)
{
System.out.println("We're sorry, \""+input+"\" was an invalid "
+ "input. Please re-run the program.");
System.exit(0);
}
System.out.println("How many withholdings do you have?");
int iWHold = 0;
input = console.next();
try
{
iWHold = Integer.parseInt(input);
}
catch (NumberFormatException nfe)
{
System.out.println("We're sorry, \""+input+"\" was an invalid "
+ "input. Please re-run the program.");
System.exit(0);
}
if (iWHold < 0)
{
System.out.println("We're sorry, \""+input+"\" was an invalid "
+ "input. Please re-run the program.");
System.exit(0);
}
System.out.println("Are you (M)arried (H)ead of Household or "
+ "(S)ingle?");
String sInput = console.next();
char cStatus = sInput.toLowerCase().charAt(0);
if (cStatus != 'm' && cStatus != 'h' && cStatus != 's')
{
System.out.println("We're sorry, \""+cStatus+"\", was an invalid"
+ "input. Please re-run the program.");
System.exit(0);
}
boolean bLowInc = false;
if ((cStatus == 's' && dGross <= 522) ||
(cStatus == 'm' && dGross <= 522 && iWHold <=1 ) ||
(cStatus == 'm' && dGross <= 1044 && iWHold >=2 ) ||
(cStatus == 'h' && dGross <= 1044))
{
bLowInc = true;
}
switch (cStatus)
{
case 's':
System.out.println("You are filing as single.");
break;
case 'm':
System.out.println("You are filing as married.");
break;
case 'h':
System.out.println("You are filing as head of household.");
break;
}
if (bLowInc)
System.out.println("You ARE classified as low income");
else
System.out.println("You are NOT classified as low income");
}
}
/* Output
F:\programs\Mod1\Project4>java Project4d
What is your gross pay?
1043
How many withholdings do you have?
1
Are you (M)arried (H)ead of Household or (S)ingle?
m
You are filing as married.
You are NOT classified as low income
F:\programs\Mod1\Project4>java Project4d
What is your gross pay?
1043
How many withholdings do you have?
1
Are you (M)arried (H)ead of Household or (S)ingle?
m
You are filing as married.
You are NOT classified as low income
F:\programs\Mod1\Project4>java Project4d
What is your gross pay?
1044
How many withholdings do you have?
2
Are you (M)arried (H)ead of Household or (S)ingle?
m
You are filing as married.
You ARE classified as low income
F:\programs\Mod1\Project4>java Project4d
What is your gross pay?
1045
How many withholdings do you have?
3
Are you (M)arried (H)ead of Household or (S)ingle?
m
You are filing as married.
You are NOT classified as low income
*/
Binary file not shown.
+214
View File
@@ -0,0 +1,214 @@
/******************************************************************************
* Project: Project 4e *
* Class Name: Project4e *
* Author: Amrit Panesar -ASP ,o/ *
* Last Edited: 09/10/2012 *
* Hours: 0.20 Hours *
* Purpose: Evaluate the input of a char representing the taxpayer's *
* filing status and reporting weather the taxpayer will be *
* taxed as a single or married person. *
* *
******************************************************************************/
import java.util.*;
public class Project4e
{
public static void main(String[] args) // main
{
Scanner console = new Scanner (System.in); //console
System.out.println("What is your gross pay?");
double dGross = 0;
String input = console.next(); //grab a string
try
{
dGross = Double.parseDouble(input); // parse it
}
catch (NumberFormatException nfe) // bomb if it doesn't validate
{
System.out.println("We're sorry, \""+input+"\" was an invalid "
+ "input. Please re-run the program.");
System.exit(0);
}
if (dGross < 0)
{
System.out.println("We're sorry, \""+input+"\" was an invalid "
+ "input. Please re-run the program.");
System.exit(0);
}
System.out.println("Are you (M)arried (H)ead of Household or "
+ "(S)ingle?");
String sInput = console.next(); // grab a string
char cStatus = sInput.toLowerCase().charAt(0); // make it lowercase, grab the first character
if (cStatus != 'm' && cStatus != 'h' && cStatus != 's') //only need to handle these
{
System.out.println("We're sorry, \""+cStatus+"\", was an invalid"
+ "input. Please re-run the program.");
System.exit(0);
}
double dBase = 0, dExcess = 0, dPercent = 0;
if (cStatus == 's' || cStatus == 'h' ) {
if (dGross <= 90)
{
dBase = 0.00;
dPercent = 0.00;
dExcess = 0.00;
}
else if (dGross > 90 && dGross <=452)
{
dBase = 0.00;
dPercent = 0.10;
dExcess = 90.00;
}
else if (dGross > 452 && dGross <= 1563)
{
dBase = 36.20;
dPercent = 0.15;
dExcess = 452.00;
}
else if (dGross > 1563 && dGross <= 3658)
{
dBase = 202.85;
dPercent = 0.25;
dExcess = 1563.00;
}
else if (dGross > 3658 && dGross <= 7533)
{
dBase = 276.60;
dPercent = 0.28;
dExcess = 3658.00;
}
else if (dGross > 7533 && dGross <= 16271)
{
dBase = 4695.14;
dPercent = 0.33;
dExcess = 7533.00;
}
else if (dGross > 16271)
{
dBase = 4695.14;
dPercent = 0.35;
dExcess = 16271.00;
}
else
{
System.out.println("Illogical.");
System.exit(0);
}
}
else if (cStatus == 'm')
{
if (dGross <= 338)
{
dBase = 0.00;
dPercent = 0.00;
dExcess = 0.00;
}
else if (dGross > 338 && dGross <=1063 )
{
dBase = 0.00;
dPercent = 0.10;
dExcess = 338.00;
}
else if (dGross > 1063 && dGross <= 3283)
{
dBase = 72.50;
dPercent = 0.15;
dExcess = 1063.00;
}
else if (dGross > 3283 && dGross <= 6283)
{
dBase = 405.50;
dPercent = 0.25;
dExcess = 3283.00;
}
else if (dGross > 6283 && dGross <= 9398)
{
dBase = 1155.50;
dPercent = 0.28;
dExcess = 6283.00;
}
else if (dGross > 9398 && dGross <= 16519)
{
dBase = 2027.70;
dPercent = 0.33;
dExcess = 9398.00;
}
else if (dGross > 16519 )
{
dBase = 4377.63;
dPercent = 0.35;
dExcess = 16519.00;
}
else
{
System.out.println("Illogical.");
System.exit(0);
}
}
else
{
System.out.println("Illogical.");
System.exit(0);
}
double dFed = dBase + ((dGross - dExcess) * dPercent);
switch (cStatus)
{
case 'm':
System.out.println("You are filing as: Married");
break;
case 's':
System.out.println("You are filing as: Single");
break;
case 'h':
System.out.println("You are filing as: Head of Household");
break;
}
System.out.printf("You gross income is: $%.2f\n", dGross);
System.out.printf("Therefore, your base tax is: $%.2f\n", dBase);
System.out.printf("Your tax surcharge percentage is: %%%.2f\n", (dPercent*100));
// System.out.printf("%s + ((%s - %s) * (%s/100)\n", dBase, dGross, dExcess, (dPercent*100)); // debugging.
System.out.printf("Your withholding tax is: $%.2f\n", dFed);
}
}
/* output:
S:\programs\Mod1\Project4>java Project4e
What is your gross pay?
31415
Are you (M)arried (H)ead of Household or (S)ingle?
s
You are filing as: Single
You gross income is: $31415.00
Therefore, your base tax is: $4695.14
Your tax surcharge percentage is: %35.00
Your withholding tax is: $9995.54
S:\programs\Mod1\Project4>java Project4e
What is your gross pay?
1231
Are you (M)arried (H)ead of Household or (S)ingle?
s
You are filing as: Single
You gross income is: $1231.00
Therefore, your base tax is: $36.20
Your tax surcharge percentage is: %15.00
Your withholding tax is: $153.05
S:\programs\Mod1\Project4>java Project4e
What is your gross pay?
555555
Are you (M)arried (H)ead of Household or (S)ingle?
m
You are filing as: Married
You gross income is: $555555.00
Therefore, your base tax is: $4377.63
Your tax surcharge percentage is: %35.00
Your withholding tax is: $193040.23
*/