CS106 W22 – Assignment 07
Due: Friday, March 11, 11:59 PM
Assignment 7 is graded out of 29 marks. There is no enhancement in this assignment. There is just one sketch to write.
There is starter code with a spreadsheet Table file: https://openprocessing.org/sketch/1501671 Your sketch will print the following as explained on the next page and in this video:
Copyright By PowCoder代写 加微信 powcoder
https://vault.cs.uwaterloo.ca/s/soiwDgXjeXwtrTq
CS 106 | Winter 2022 | Assignment 07 | Page 1 of 4
You are to create a sketch to do the following.
The starter code loads the table named “FinancialSample.cdv”.
a) [ 5 marks ] Create a function named “unitsSold()”. The function unitsSold() should calculate and print the total number of units sold. As in the image on the previous page, put “Units Sold” on one line and then the number on the next line and then three equal signs on the next line. This will help with grading.
b) [ 5 marks ] Create a function named “canadaUnits2014()”. The function canadaUnits2014() should calculate and print the total number of units sold in Canada in 2014. Format the output to be as in the image on the previous page.
c) [ 5 marks ] Create a function named “profitPerYear()”. The function profitPerYear() should calculate and print the total profit in 2013 and 2014. Format the output to be as in the image on the previous page.
d) [ 5 marks ] Create a function named “countriesList()”. The function countriesList() should determine and print the countries from the second column in “FinancialSample.cdv”. Format the output to be as in the image on the previous page.
e) [ 5 marks ] Create a function named “profitPerMonth()”. The function profitPerMonth() should draw a Bar Graph on the canvas. The Bar Graph should look like the following:
CS 106 | Winter 2022 | Assignment 07 | Page 2 of 4
[ 4 marks ] Coding Style and Efficiency
Coding style is evaluated in all sketches.
Follow the course coding style for whitespace and comments. Consult the “Code Style Guide” on LEARN.
1) [ 0.5 ] Include your name and student ID number at the beginning of your code.
2) [ 0.5 ] Comment your code appropriately. Avoid superfluous comments.
3) [ 0.5 ] Correctly and consistently indent your code blocks.
4) [ 0.5 ] Use correct inline spacing.
5) [ 0.5 ] Use good line spacing to chunk sections of your code.
6) [ 0.5 ] All variable names are meaningfully chosen.
7) [ 0.5 ] No variables are declared but not used.
8) [ 0.5 ] You may not use any functions or statements not covered in lecture or labs. This
includes, but is not limited to:
• No translate(), rotate(), or scale() functions.
Submitting
Use the template file in Word “CS106 Assignment Template” in LEARN (under Assignment 01) to create your Assignment 07 submission for your sketch.
Then convert your Word file to pdf. Please ensure that your URLs are hot links. The TAs need to be able to click on each link in your pdf and go directly to your sketch.
So for example, don’t have a link like this: https://openprocessing.org/sketch/1050954
but rather have that link as a hot link as follows: https://openprocessing.org/sketch/1050954
CS 106 | Winter 2022 | Assignment 07 | Page 3 of 4
Ensure that each URL you submit has its settings so that the access is as follows:
Submit that pdf file to the Assignment 07 dropbox on LEARN.
An example of how to do submit a Lab or Assignment sketch is shown in the following video from
Lab 0: https://vault.cs.uwaterloo.ca/s/MgPD3pBEMjmHQYz
CS 106 | Winter 2022 | Assignment 07 | Page 4 of 4
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com