SENG6110 Programming Assignment 1 – Trimester 1, 2023
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
SENG6110 Programming Assignment 1 – Trimester 1, 2023
Electronic submission via Canvas by 11:59pm on Friday 17th March 2023
Cryptocurrency Capital Gains Tax and Profit
Introduction
The objective of this individual assignment is the implementation of an object-oriented program using Java to calculate Capital Gains Tax (CGT) and profit when an individual sells and buys cryptocurrency, you cannot use Arrays for this assignment. Also, UML Class diagram needs to be drawn. The details are given in this document (please note: the rules in this assignment are differentfrom Australia Taxation Office). The assignment 2 will be an extension of this assignment.
Before 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 “SENG6110-HelpToStartAssign1-T1-2023” and some Java files on Canvas, which you can use as a starting point.
Problem specification
Cryptocurrency is a digital currency that does not rely on any central authority and uses cryptography to secure transactions. Cryptocurrency is considered an asset (like shares or property) rather than a currency for taxation purposes. The following tables detail the tax brackets of our progressive tax system which you will need to calculate CGT for cryptocurrency. Note that the first table is for Australian residents and the next one is for non residents.
Tax rates -- residents
Taxable income |
Tax %age for Cryptocurrency |
$0 – $18,200 |
0% |
$18,201 – $45,000 |
19% |
$45,001 – $120,000 |
32.5% |
$120,001 – $180,000 |
37% |
Over $180,001 |
45% |
Tax rates – non residents
Taxable income |
Tax %age for Cryptocurrency |
$0 – $120,000 |
32.5% |
$120,001 – $180,000 |
37% |
Over $180,001 |
45% |
The first task of the program is to calculate the CGT on cryptocurrency 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 – name of the user.
• Annual salary for an entire year (this needs to be a positive number and different from zero; if not, the program will show an error message and ask the salary again).
• Resident - if the user is a resident or not.
• Buying price of the cryptocurrency (the buying price needs to be a positive number and different from zero; if not, the program will show an error message and ask the buying price again).
• Selling price of the cryptocurrency (the selling price needs to be a positive number and different from zero; if not, the program will show an error message and ask the selling price again). For this assignment we are assuming that the selling price is always more than buying price so this should be checked as well, otherwise an error message is shown and ask again for selling price.
• No of years cryptocurrency is held (this needs to be a positive integer and different from zero; if not, the program will show an error message and ask again).
The program is then expected to display:
• The correct amount of CGT the individual should pay for this year on the profit of the cryptocurrency, the following should be considered to calculate that:
Profit = Selling price – Buying price |
Profit for CGT = Profit / No of years cryptocurrency is held |
Total Annual income = Annual salary + Profit for CGT |
Find the tax rate for Total Annual income as Tax rate. |
CGT = Tax rate * Profit for CGT |
Actual Profit = Profit for CGT - CGT |
Consider the following examples for clear understanding:
If the Buying price is $5,000 of cryptocurrency and it was held for 4 years before selling it for $9,000. This means profit is $4,000. But as the cryptocurrency was held for more than 1 year, so profit for CGT is $1,000 ($4000/4). This amount will be added on to annual salary which, let’s say is $75,000 for the user who was resident. This means total income is $76,000 and tax rate is 32.5%. To work out the capital gains tax owed on just cryptocurrency sale, multiply the profit by the tax rate: $1000 x 0.325 = $325 and Actual profit is: $1000 – $325 = $675.
The second task of the program is to calculate and display predicted profit of future cryptocurrency investments. First, the program should ask:
• Initial Investment amount as the amount of money that the user wants to invest in cryptocurrency again for the period of three years. This amount can only be up to the Actual profit, profit earned on the cryptocurrency sale calculated in the first task (the amount needs to be a positive number and different from zero; if not, the program will show an error message and ask it again)
• Yearly Investment amount as the additional amount of money that the user wants to invest in cryptocurrency for the next two years. User must provide two values here (the amount needs to be a positive number or zero; if not, the program will show an error message and ask it again)
• Cryptocurrency – the cryptocurrency that user chooses to invest in. You need to provide three options: Bestcoin, Simplecoin and Fastcoin (user must choose one of the options: otherwise the program will show an error message and ask again). The predicted profit rates for the three cryptocurrencies are shown in the following table:
Predicted Profit Rate |
||
Bestcoin |
Simplecoin |
Fastcoin |
18% |
12% |
15% |
• The program is then expected to display a table with details of the yearly profit for the next three
Example: Suppose the profit from the cryptocurrency was $500 and user wants to invest it in Fastcoin and will invest $1000 more at the end of first year and $500 at the end of second year. The predicted profit table looks like:
Years |
Yearly profit |
Total Profit |
1 |
$500* 0.15 = $75 |
$75 |
2 |
($500 + $1000) * 0.15 = $225 |
$75 + $225 = $300 |
3 |
($500 + $1000 + $500) * 0.15 = $300 |
$75 + $225 + $300 = $600 |
Example Output (simplified)
User Details: Name: Bob Kyle Annual Salary: 75,000 Resident: Yes Cryptocurrency: Buying Price: $5000 Selling Price:$9000 Years: 4 Capital Gains Tax: Tax Rate: 0.325 CGT: $325 Profit: $675 Would you like to invest? Yes Initial Investment Amount (cannot be more than $675): $500 investment Amount after First year: $1000 investment Amount after Second year: $500 Choose the Cryptocurrency to invest in: 1 for Best Coin 2 for Simple Coin 3 for Fast Coin Enter your coin selection: 3 Predicted Profit for Investment in Fast Coin Years YearlyProfit TotalProfit ---------------------------------- 1 $75 $75 2 $225 $300 3 $300 $600 |
Program Requirements
There must be three classes:
Investment, User, CgtInterface.
1) The Investment Class (the file needs to be Investment.java): The instance variables will be (at least):
• year1Deposit – double
• year2Deposit – double
• year3Deposit – double
• coinSelection -- int
The class needs to have methods to change and access all instance variables and also the method (at least) calcInvestment(), which will calculate the profit and display the profit amount at the end of each year. The instance variables will be private. Make sure to have methods to get and set the values of the instance variables for example getCoinSelection, setCoinSelection etc.
2) The User Class (the file needs to be User.java) The instance variables will be (at least):
• name – a String
• investAccount – Investment
• annualSalary – double
• buyingPrice – double
• sellingPrice – double
• years -- int
• resident -- boolean
The class needs to have methods to change and access all instance variables. For example you must have methods like getName, setName, getResident,setResident etc It also will have (at least) the methods calcCgt(), which will calculate the CGT. The instance variables will be private. User class must have methods to access instance variables of the Investment class (please see the method setInvestCoinSelection() in User.java file provided on Canvas).
3) The CgtInterface Class (the file needs to be CgtInterface.java). The instance variables will be (at least):
• user – User
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. This class is the only class that will have a main method, which should create an instance of the class CgtInterface, and call a method run(), which will display the menu to the user. A template of this class is provided on Canvas. 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.
How to start
On Canvas you can find a file (SENG6110-HelpToStartAssign1-T1-2023.pdf) that provides helpful tips to start your assignment. A set of templates for the required Java files is also provided on Canvas as:
• CgtInterface.java
• Investment.java
• User.java
UML class diagram can be drawn using MS Visio or any other online tool (like draw.io). As UON student you can download MS Visio from https://azureforeducation.microsoft.com/devtools.
What to submit
You should submit one compressed .zip file via the "Assignment 1" link on Canvas, which should have:
1. Three .java files (Investment.java, User.java, CgtInterface.java). Do not include .class files in your submission. Add your student name(s) on the top of each Java file submitted.
/*Author: name
*Student No: XXXXXX
*Date: 02-03-2022
*Description:
*/
2. A file containing a UML class diagram of your program. The UML diagram must contain all three classes. must have all the instance variables as private and methods as public for the three classes.
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- andexams/adverse-circumstances for more details.
In Canvas you will find a new forum in the discussion board: “assignment1” . Any question about the assignment you can post there. Check this forum regularly.
2023-03-16