0% found this document useful (0 votes)
81 views

Programming Project Document - Itss 3211 2

This document contains a student's assignment submission for an introductory programming course. It includes the student's name, course details, a pledge acknowledging the academic honesty policy, and sections analyzing the required program, describing its design, providing the coding, and testing the results. The program calculates and displays the taxes owed based on a user's filing status and income level entered through a scanner.

Uploaded by

api-300862215
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

Programming Project Document - Itss 3211 2

This document contains a student's assignment submission for an introductory programming course. It includes the student's name, course details, a pledge acknowledging the academic honesty policy, and sections analyzing the required program, describing its design, providing the coding, and testing the results. The program calculates and displays the taxes owed based on a user's filing status and income level entered through a scanner.

Uploaded by

api-300862215
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

ITSS 3211 Introduction to Programming

Dr. Nassim Sohaee


Fall 2015

Student name: Adam Melaku


Course Number: ITS-3211
Section Number: 003
Due Date: 10/11/15
Important notes:
If you work with another student or get help from a tutor, please indicate this on
your assignment.
Pledge:
I understand that the consequences of committing any act of academic dishonesty
can include a failing grade for the assignment, failure in the class as a whole, and
even expulsion from the university. I will not plagiarize or cheat.
Analysis:
I had to design a program that would display the tax owed by the user after the user
provided their filling status (Single, Married filing jointly, Married filing separately, or
head of household) and their income level. The program would then calculate how
much is owed after taking into account these two qualifiers and output to the user
how much they owe in taxes. To summarize, this program helps the user know how
much they owe in taxes once they give their filling status and income level.

Design:
First I had to design to import a scanner and then I began to add the variables that
would be needed to perform the proper calculations when calculating the taxes
(taxableIncome and owedTaxes) and when using the switch statement (status). After
that I had to get the program to ask for inputs from the user to assign as values to
the necessary variables. The user would be prompted to enter their filling status as
0,1,2, or 3 (The parameters for the project said that 0 means filling as single, 1
means married filling jointly, 2 means married filling separately, and 3 means head
of household) in addition to their income level. In order to perform the calculations
properly it would require multiple if else statements and the proper logical

operations to perform the tax calculations properly. The program would display the
Taxes owed by displaying the value of the variable owedTaxes.

Coding:
///////////////////////////////////////
////////////////////////////////////////
//
ALL STUDENTS COMPLETE THESE SECTIONS
// Title:
TaxProject
// Files:
java.util.Scanner
// Semester:
//Fall 2015
//
// Author:
Adam Melaku
//Email:
Aam131630
// CS Login:
Aam131630
// Lecturer's Name: Professor Sohaee
// Course Section:
001
//
//////////////////// STUDENTS WHO GET HELP FROM OTHER THAN THEIR
PARTNER //////
//
fully acknowledge and credit all sources of help,
//
other than Instructors and TAs.
//
// Persons:
None.
//
// Online sources:
None.
//////////////////////////// 80 columns
wide //////////////////////////////////
import java.util.Scanner;
//Calculates the amount in taxes owed by filing status and income level.
//Bugs: None
//@Adam Melaku
public class TaxProject {
// A scanner needs to be created and the user will be asked to enter
their filling status.
// 0 for single, 1 for married filling jointly, 2 for married filling
separately and 3 for head of household.
// The user will later enter their income level.
// Switch statement will be used to determine designation for filling
status and then perform appropriate calculations to determine take owed.
// The calculated tax owed will be displayed at the end of the program
(taking into consideration the users filling status and income level).
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int status;
double taxableIncome;
double owedTaxes;

//declare variables

System.out.println("Enter filing status");


//prompt user for
filing status. User enters 0 for single, 1 for married filling jointly,

status = input.nextInt();
filling separately and 3 for head of household.

// 2 for married

System.out.println("Enter taxable income");


enter income.
taxableIncome = input.nextDouble();

//prompts user to

switch(status%4){
//switch
statement decides what filling status is and performs appropriate calculation
case 0:
//to output
appropriate statement.
if (taxableIncome <= 8350){
owedTaxes = taxableIncome*.1;
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 33950){
owedTaxes = ((taxableIncome-8350)*.15) +
(8350*.1);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 82250){
owedTaxes = ((taxableIncome-33950)*.25) +
(8350*.1) + (25600*.15);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 171550){
owedTaxes = ((taxableIncome82250)*.28) +(8350*.1) + (25600*.15) + (48300*.25);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 372950){
owedTaxes = ((taxableIncome171550)*.33) + (8350*.1) + (25600*.15) + (48300*.25) + (89300*.28);
System.out.println("Tax is "+ owedTaxes);}
else{
owedTaxes = ((taxableIncome372950)*.35) + (8350*.1) + (25600*.15) + (48300*.25) + (89300*.28) +
(201400*.33);
System.out.println("Tax is "+ owedTaxes);}
break;
case 1:
if (taxableIncome <= 16700){
owedTaxes = taxableIncome*.1;
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 67900){
owedTaxes = ((taxableIncome-16700)*.15) +
(16700*.1);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 137050){
owedTaxes = ((taxableIncome-67900)*.25) +
(16700*.1) + (51200*.15);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 208850){

owedTaxes = ((taxableIncome137050)*.28) +(16700*.1) + (51200*.15) + (69150*.25);


System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 372950){
owedTaxes = ((taxableIncome208850)*.33) + (16700*.1) + (51200*.15) + (69150*.25) + (71800*.28);
System.out.println("Tax is "+ owedTaxes);}
else{
owedTaxes = ((taxableIncome372950)*.35) + (16700*.1) + (51200*.15) + (69150*.25) + (71800*.28) +
(164100*.33);
System.out.println("Tax is "+ owedTaxes);}
break;
case 2:
if (taxableIncome <= 8350){
owedTaxes = taxableIncome*.1;
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 33950){
owedTaxes = ((taxableIncome-8350)*.15) +
(8350*.1);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 68525){
owedTaxes = ((taxableIncome-33950)*.25) +
(8350*.1) + (25600*.15);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 104425){
owedTaxes = ((taxableIncome68525)*.28) +(8350*.1) + (25600*.15) + (34575*.25);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 186475){
owedTaxes = ((taxableIncome104425)*.33) + (8350*.1) + (25600*.15) + (34575*.25) + (35900*.28);
System.out.println("Tax is "+ owedTaxes);}
else{
owedTaxes = ((taxableIncome186475)*.35) + (8350*.1) + (25600*.15) + (34575*.25) + (35900*.28) +
(82050*.33);
System.out.println("Tax is "+ owedTaxes);}
break;
case 3:
if (taxableIncome <= 11950){
owedTaxes = taxableIncome*.1;
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 45500){
owedTaxes = ((taxableIncome-11950)*.15) +
(11950*.1);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 117450){
owedTaxes = ((taxableIncome-45500)*.25) +
(11950*.1) + (33550*.15);

System.out.println("Tax is " + owedTaxes);}


else
if (taxableIncome <= 190200){
owedTaxes = ((taxableIncome117450)*.28) +(11950*.1) + (33550*.15) + (71950*.25);
System.out.println("Tax is " + owedTaxes);}
else
if (taxableIncome <= 372950){
owedTaxes = ((taxableIncome190200)*.33) + (11950*.1) + (33550*.15) + (71950*.25) + (72750*.28);
System.out.println("Tax is "+ owedTaxes);}
else{
owedTaxes = ((taxableIncome372950)*.35) + (11950*.1) + (33550*.15) + (71950*.25) + (72750*.28) +
(182750*.33);
System.out.println("Tax is "+ owedTaxes);}
break;
}
}
}

Testing:
I compiled the program and overall it worked great on my first try but there was
some debugging that needed to be done. I needed to readjust my quotes on my
system.out.prtinln lines so when it outputted the tax owed it wouldnt show up
mashed together. (I.e. Tax is 1940 instead of Tax is1940). In addition, I did a
small mathematical error in case 2 (human error) that I was able to troubleshoot
after a few minutes of attention. Overall, the program performed the calculations
properly and after I finished debugging it, I got the same answers the sample for our
project got and was satisfied with my work.

You might also like