关键词 > SENG1110/6110

SENG1110/6110 Programming Assignment 1 – Semester 1, 2022

发布时间:2022-04-29

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

SENG1110/6110 Programming Assignment 1 – Semester 1, 2022

Income Tax and Investment Calculator

Introduction

The  objective  of this  assignment  is the  implementation  of an  object-oriented  program  using Java to  calculate income tax  and  investment growth  based  on the yearly  income/salary  of  an  individual.  Below the  details  are described (The rules in this assignment are different from Australia Taxation Office). The assignment 2 will be an extension of this assignment.

SENG1110 students - This assignment can be completed in pairs.

SENG6110 students - This assignment must be completed individually.

Befofe you start

Carefully  read the  specification  below.  Make  sure you  have  all the  information  necessary to  start writing the program. If you are uncertain of something, do not make assumptions. Post your questions to the discussion board forum named "assignment 1" and check it regularly.

Try to start the assignment as soon as possible. There is a document HelpToStartAssign1” and some Java files on Blackboard, which you can use as a starting point.

Problem specification

In Australia, a taxpayer's income is taxed progressively. Progressive taxation means that higher income earners pay more tax than lower income earners. The following tables detail the tax brackets of our progressive tax system for the financial years ending 30 June 2021 and 30 June 2022. Note that the first table is for Australian residents and the next one is for non residents.

Tax rates 2010- 11  residents

Taxable income

Tax on this income

$0 – $18,200

Nil

$18,201 – $45,000

19c for each $1 over $18,200

$45,001 – $120,000

$5,092 plus 32.5c for each $1 over $45,000

$120,001 – $180,000

$29,467 plus 37c for each $1 over $120,000

Over $180,001

$51,667 plus 45c for each $1 over $180,000

Tax rates 2010- 11  non residents

Taxable income

Tax on this income

$0 – $120,000

32.5c for each $1

$120,001 – $180,000

$39,000 plus 37c for each $1 over $120,000

Over $180,001

$61,200 plus 45c for each $1 over $180,000

Residents are also required to pay 2% of Medicare levy if your taxable income is greater than $29,032, which is calculated at 2% of your taxable income. Non-residents are not required to pay the Medicare levy.

The first task of the program is to calculate the appropriate income tax for an individual based on a set of inputs by the user and the information provided in the Tax tables above. The user should provide the program with

•    Name (the name needs to have at least two names first name and last name; if not, the program will show an error message and ask the user the name again),

•    Annual income/Salary (income) for an entire year (the salary needs to be a positive number and different from zero; if not, the program will show an error message and ask the salary again)

•    Residence - if the user is a resident or not.

The program is then expected to display:

•    the net salary of this particular individual per year and per week.

•    The correct amount of tax the individual should pay per year and per week (as defined by the Tax rates above).

•    If the individual pays the Medicare Levy and if so, how much per year.

The second task of the program is to calculate/display a possible investment. First, the program should ask

•    the amount of money that the user requires (on an average) per week as living expenditure. You are to assume this expenditure value does not change for the individual over time. (the amount needs to be a positive number and different from zero; if not, the program will show an error message and ask the salary again)

•    On the basis of this information the program should advise the user whether or not the amount the user is earning each week is sufficient to cover the weekly expenses. If the user earns less than the amount that is required to live, you should show a warning message and ask if the user would like to enter a new amount or terminate the program.

•    If an amount is sufficient to cover weekly expenses, the program should ask if the user would like to invest some money. If yes, the program should ask

-      Investment  value  -  the  amount  of  money  that  the  user  would  like  to  invest  per  week  (it  is necessary to verify if this amount is feasible. If not, show an error message and ask again)

-      Interest rate - the interest rate of the investment account per annum (the interest rate needs to be between 1% and 20%; otherwise the program will show an error message and ask the user for the interest rate again)

-      Investment length - number of weeks that the user will invest the money (it needs to be a positive number and different from zero; otherwise the program will show an error message and ask the number of weeks again)

•    The program is then expected to display:

-      a table with details of the investment at four week intervals for the length of the investment. For the  purposes  of this  assignment you will  assume that  interest  is  only  applied  at the  end  of a complete four week period, see the example below.

Example

Suppose a resident with yearly income of $40,000.00. The Medicare Levy will be $800.00 and the taxes will be $4142.00/year or $79.65/week. The net salary per year will be $35058.00 or $674.19 per week. Suppose the user needs $500 per week as living expenditure. So it is possible to invest $174.20 per week. Suppose the interest is 13% per year (or 1% each 4 weeks, since we have 52 weeks per year) and the number of weeks the user will invest the money is 18. Assuming the user asks to invest $50 per week, then the investment account output will be:

Weeks

Money in the end of each 4 weeks

4

$202.00 = 50*4*1.01

8

$406.02 = (202+50*4)*1.01

12

$612.08 = (406.02+50*4)*1.01

16

$820.20 = (612.08+50*4)*1.01

18

$920.20 = (820.20 + 50*2) (note that is less than 4 weeks, so the interest is not applied)

Example Output (simplified)

Name: Eliza Smith

Net Salary

Per Week: $674.19

Per Year: $35058.00

Tax Paid

Per Week: $79.65

Per Year: $4142.00

Medicare Levy Per Year: $800.00

Would you like to invest? Yes

The amount per week: $50

Interest rate (between 1-100): 13

Investment length (# of weeks): 18

Investment

Weeks       Balance

--------------------

4           $202.00

8           $406.02

12          $612.08

16          $820.20

18          $920.20

Program Requirements

There must be three classes: Client, Account, CalculatorInterface.

•    The Account Class (the file needs to be Account.java) The instance variables will be (at least):

•    rate double

•    numberOfWeeks int

    amount double

The class needs to have methods to change and access all instance variables and also the method (at least) calcInvestment(), which will calculate the investment and will return a String, which will have the amount in the investment account in the end of each month. The instance variables will be private.

•    The Client Class (the file needs to be Client.java) The instance variables will be (at least):

•    name  a String

•    savingAccount  Account

•    grossSalary  double

•    netSalary double

•    resident boolean

•    tax double

•    medicare – double

•    weeklyExpenses – double

The class needs to have methods to change and access all instance variables. It also will have (at least) the methods  calcTax(), which will  calculate the tax  and calcMedicare(), which will  calculate the  medicare. The instance variables will be private.

•    The CalculatorInterface Class (the file needs to be CalculatorInterface.java) Creates the interface (TerminalIO or GUI, you choose).

The instance variables will be (at least):

•    client Client

This class will  receive the inputs from  user, show the outputs, will check for wrong inputs and show error messages.

Notice that only this class will receive inputs and show outputs.

This  class  is  the  only  class  that  will  have  a  main  method,  which  should  create  an  instance  of  the  class CalculatorInterface, and call a method run(), which will display the menu to the user. A template is shown below.

public class CalculatorInterface {

private void run(){

//...

}

public static void main(String[] args){

CalculatorInterface c = new CalculatorInterface ();

c.run();

}

}

You must not use any form of arrays in this assignment.

Marks will  be awarded for  layout  (including visual aspects  (variable  names,  indentation) and structural aspects (variable scope, method usage)), documentation (comments), and the submission's ability to perform as specified. A more detailed marking schema is available on Canvas.

What to submit

You should submit only the three .java files (Account.java, Client.java, CalculatorInterface.java), in a compressed .zip file, via the "Assignment 1" link on Canvas. Do not include .class files in your submission.

Add your student name(s) on the top of each Java file submitted. If you are completing the assignment as a group (only SENG1110 students), add both names in each Java file. Follow the following template.

/*Author: name

*Student No: XXXXXX

*Date: 02-03-2022

*Description :

*/

Extra Work for SENG6110 students

You need to provide a UML class diagram of your program. Extra material, including lecture slides and a video are available in Blackboard. You also must implement GUI.

Late Penalty and adverse circumstances

Note that your mark will be reduced by 10% for each day (or part day) that the assignment is late. This applies equally to week and weekend days. You are entitled to apply for special consideration if adverse circumstances have had an impact on your performance in an assessment item. This includes applying for an extension of time to complete  an  assessment  item.  See  https://www.newcastle.edu.au/current-students/learning/assessments-and- exams/adverse-circumstances for more details.

In  the  Canvas  you  will  find  a  new  forum  in  the  discussion  board:  “assignment1” .  Any  question  about  the assignment 1 you can post there. Check this forum regularly.