COIT20245 Introduction to Programming - Java - Assignment 1

Task

Write a java console application for calculating income tax for N company employees. N should be declared as a constant and it should be equal to the largest digit of your student ID number (e.g. if your ID number is S456222 then N should be equal to 6 and you can declare it as final int N=6). The income tax and tax group for taxable income

The application should ask the user to enter the taxable income for each employee (total N employees) and calculate the income tax for each employee. The application should display the income tax for each employee as shown in the example below. At the end of the Nth employee, the details such as highest tax, lowest tax, number of employees in Group 1, number of employees in Group 5 and tax group with highest number of employees should be displayed. If more than one group has the same number of employees then the group with higher number should be displayed, e.g. Group 1 and Group 5 both have 2 employees which is highest number of employees then 5 should be displayed).

Example for N=6

Enter the taxable income for employee 1: 17500

The income tax for employee 1 is $0.00

Enter the taxable income for employee 2: 19200

The income tax for employee 2 is $190.00

Enter the taxable income for employee 3: 38000

The income tax for employee 3 is $3897.00

Enter the taxable income for employee 4: 90000

The income tax for employee 4 is $20932.00

Enter the taxable income for employee 5: 181000

The income tax for employee 5 is $54547.00

Enter the taxable income for employee 6: 15000

The income tax for employee 6 is $0

Highest tax: $54547.00

Lowest tax: $0.00

Number of employees in Group 1: 2

Number of employees in Group 5: 1

Tax group number with highest number of employees: 1

Your application is to follow the same format for input and output as in the example above, but with customised welcome and exit messages.

The application is to use the following classes.

public class Tax

{

// variable/constant declarations

public Tax()

{

// constructor

}

public double calculateTax(double taxableIncome)

{

// code to calculate tax based on tax brackets shown in Table 1

}

public int highestTaxGroup(int group1, int group2, int group3, int group4, int group5)

{

// code to determine and return tax group number with highest number of employees

}

}

public class TaxTest

{

public static void main(String[] args)

{

//declare variables/constants

//display welcome message

//loop to input taxable income, calculate and display tax

//generate and display report

//display exit message

}

}

Warning: Arrays and other things that are not covered in COIT20245 lectures and labs (weeks 1-6) are not allowed in this assignment.

Order Now