Assessment item 2 - CG Bar Chart TASK Flock Stock Professionals (FSP) is a business that offers tax advisory services. They specialize in tax matters related to stock market investments. In this...

1 answer below »
Dummy


Assessment item 2 - CG Bar Chart TASK Flock Stock Professionals (FSP) is a business that offers tax advisory services. They specialize in tax matters related to stock market investments. In this assignment you will create a small program that can help FSP calculate their clients’ capital gains and the applicable taxes. The program should ask for following inputs • Date of stock purchase • Date of stock sale • Number of shares involved • Share purchase price per unit • Share sale price per unit • Client's annual gross income Using the above data, the program will calculate and display the total purchase value, total sale value, raw capital gains (or losses), taxable capital gains and the tax due. According to Australian tax rules, if a stock is sold after being held for 12 months or more, then only 50% of the raw capital gains are taxable. This is called CGT discount. If a stock is sold within 12 months of purchase, no CGT discount applies, or in other words taxable capital gain is same as raw capital gain. Tax is calculated according to client’s annual gross income (in the financial year shares were sold) and then work out the tax rate automatically according to table below. Task • Program should prompt for three (3) stock holdings, not just one. • It should get date inputs in YYYY-MM-DD format. (Assume that user will not make any mistake in typing the dates.) • The program will ask for their annual gross income (in the financial year shares were sold) and then work out the tax rate automatically according to table below. After entering stock data for all holdings, the program should display a bar chart of raw capital gains from all holdings. Use Python turtle graphics to draw the chart. To work with dates, you are provided with a monthcalc python module. It contains a single function with the following definition: def twelve_month_apart (date1, date2): .... This function takes in two date parameters (both strings, in YYYY-MM-DD format) and returns True if date2 is later than date1 by twelve months or more. Otherwise, it returns False. You do not need to understand the code in this module, but you will import it and use the above function in order to check for CGT discount eligibility. To draw the bar chart using turtle graphics, you are required to create two functions • draw_axes(left_bottom_x, left_bottom_y, width, height, y_max) This will draw the axes as shown in figure below. The parameters left_bottom_x and left_bottom_y indicate the coordinates of origin point. width and height define the size of bar chart (in pixels). y_max is the maximum value this chart can display (1000 in figure below). As you can see in figure, this function should also draw five horizontal dim lines to indicate five steps up to y_max. • draw_bar(middle_x, bottom_y, width, height) Calling this function once will draw a single rectangular bar such with (middle_x, bottom_y) as the base point. width and height define the size of a single bar (again in pixels). Use the above two functions to plot the raw capital gains from each of the three stock holdings. Do not show a bar for capital losses. Review the sample run below to clearly understand all requirements of your program. === Enter data for stock holding 1 === Purchase date (YYYY-MM-DD) : 2019-01-04 Sale date (YYYY-MM-DD) : 2019-10-11 Number of shares : 165 Purchase price per unit : 12.36 Sale price per unit : 19.81 Client's annual gross income: 70365 Total purchase value = $2,039.40 Total sale value = $3,268.65 Capital gains = $1,229.25 This stock was held for less than 12 months. Client is *not* eligible for a discount on capital gains tax. Taxable capital gains = $1,229.25 Income tax rate = 32.5% Tax due = $399.51 === Enter data for stock holding 2 === Purchase date (YYYY-MM-DD) : 2016-10-05 Sale date (YYYY-MM-DD) : 2020-12-25 Number of shares : 78 Purchase price per unit : 52.30 Sale price per unit : 49.55 Client's annual gross income: 95500 Total purchase value = $4,079.40 Total sale value = $3,864.90 Capital gains = $-214.50 Client made a capital loss. No taxes are applicable. === Enter data for stock holding 3 === Purchase date (YYYY-MM-DD) : 2018-01-08 Sale date (YYYY-MM-DD) : 2021-02-28 Number of shares : 480 Purchase price per unit : 23.11 Sale price per unit : 39.72 Client's annual gross income: 35120 Total purchase value = $11,092.80 Total sale value = $19,065.60 Capital gains = $7,972.80 The stock was held for 12 months or more. Client is *eligible* for a discount on capital gains tax. Taxable capital gains = $3,986.40 Income tax rate = 19% Tax due = $757.42 === Bar chart opens in new window === Thanks for using this app. Constraint: You can only import these Python modules: turtle, math and monthcalc You should follow good programming practices, for example using named constants, creating several functions (top-down design) and minimizing the use of global variables. Your assignment should consist of following tasks. Task 1 Draw a flowchart of your main() function, including flowcharts for all other functions that are called by main() except draw_axes and draw_bar (you do not need to flowchart these two). You can draw the flowcharts using draw.io or lucid chart software. Task 2 Select four sets of test data that will demonstrate the 'normal' operation of your program; that is, test data that will demonstrate what happens when a valid input is entered. Select three sets of test data that will demonstrate the 'abnormal' operation of your program. Please note that for this application, user input includes mouse clicks as well as keyboard button presses. Set out test results in a tabular form as follows. It is important that the output listings (i.e. screenshots) are not edited in any way. Test Data Table Test data type Test data The reason it was selected The output expected due to the use of the test data The screenshot of actual output when the test data is used Normal Normal Abnormal Abnormal Task 3 Implement your program in Python. Comment on your code as necessary to explain it clearly. Run your program using the test data you have selected and complete the final column of test data table above. Your submission will consist of: 1. Your algorithm through flowchart/s 2. The table recording your chosen test data and results (it should be a Word file) 3. Source code for your Python implementation It is critically important that your test runs are unmodified outputs from your program, and that these results should be reproducible by the marker running your Python program. RATIONALE This assessment task will work towards assessing the following learning outcome/s: • be able to analyze the steps involved in a disciplined approach to problem-solving, algorithm development and coding. • be able to demonstrate and explain elements of good programming style. • be able to identify, isolate and correct errors; and evaluate the corrections in all phases of the programming process. • be able to interpret and implement algorithms and program code. • be able to apply sound program analysis, design, coding, debugging, testing and documentation techniques to simple programming problems. • be able to write code in an appropriate coding language. MARKING CRITERIA AND STANDARDS Flowchart (3 marks) Algorithm design is efficient in terms of time and memory. Flowcharts do not have any unnecessary component. Testing documentation (3 marks) Test data is explores every branch of the program. To demonstrate comprehensive testing, number of test cases exceeds the required minimum. Program functionality (6 marks) Python code contains only necessary statements and variables. Python code produces correct results. Program meets all specifications. Output format is correct as required. Code style (2 marks) Code includes function header comments and module level docstrings. Code design is modular, containing several reusable functions. Named constants are used instead of magic numbers. White space is appropriately used for code readability. Hints: total purchase value = (Share purchase price per unit) * (No. of shares) total sale value = (Share sale price per unit) * (No. of shares) Raw capital gains = (Total sale value) -(Total purchase value) Calculating taxable capital gains, incase stocks was held for more than 12 months, a discount of 50% applies. • CGT discount = (raw capital gains)/2 Now, Calculating Tax due when a discount of 50% is applied • Tax due after discount = (Income tax rate / 100) * (CGT discount) Calculating taxable capital gains, if stock sold within 12 months of purchase, is equal to Raw capital gain So, calculating Tax due, when no discount applies Normal tax due = (Income tax rate / 100) * (Raw capital gain) Note :- the output of currency values should be formatted with comma separators and two digits precision.
Answered Same DayDec 29, 2021

Answer To: Assessment item 2 - CG Bar Chart TASK Flock Stock Professionals (FSP) is a business that offers tax...

Srujan P answered on Feb 13 2021
140 Votes
import matplotlib.pyplot as plt
import datetime
#import monthcalc
#import math
k=1
a=[]
#def cg
bar():
while(k<=3):
    print('===Enter data for stock holding ',k,"===")
    #taking the input's from the user
    date_entry_p = input('Date of stock purchase (YYYY-MM-DD) : ')
    year, month, day = map(int,date_entry_p.split('-'))
    date1 = datetime.date(year, month, day)
    #print(date1)
    date_entry_s = input('Date of stock sale (YYYY-MM-DD) : ')
    year, month, day = map(int,date_entry_s.split('-'))
    date2 = datetime.date(year, month, day)
    #print(date2)
    no_of_shares = int(input('Number of shares involved : '))
    share_purchase = float(input('Share purchase price per unit : '))
    share_sale = float(input('Share sale price per unit : '))
    annual_gross = int(input('Client\'s annual gross income :'))
    print('Purchase date(YYYY-MM-DD) : ',date1)
    print('Sale date(YYYY-MM-DD) : ',date2)
    print('Number of shares : ',no_of_shares)
    print('Purchase price per unit : ',share_purchase)
    print('Sale price...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here