To the main website of James Tam | Return to the CPSC 203 web page |
Due dates for all assignments can be found on the [main grid] of the course webpage.
Note: The computer lab for CPSC 203 is located in SS018 (the "Tri-Labs"). If you find that your particular version of Word (e.g. Office 365, older versions of Office, MAC users) does not include everything needed for a feature then you should to complete that feature in SS018. Alternatively for the remote learning version of the course you can login to a lab computer from your own. [Information link created by UC-IT with modifications by James Tam, for questions: www.ucalgary.ca/it]
The previous comments from the last workbook exercise apply: it's more challenging than some of the others, it will give you a better idea of what writing real life programs are like, you will get better at programming by writing more programs etc. But I should add: If there is one exercise that you should not skip it is this one. This exercise may be one of the most challenging ones that you will be required to solve but the solution involves issues similar although simpler than the ones in the assignment. Working through this problem will assist you with the assignment so don't just skip attempting it just because of the low marking weight.
Starting files that you should modify and submit:
Complete the features specified below and submit the macro enabled spreadsheet along with the starting Word document into D2L.
In addition to backing up your work into the Word spreadsheet it's critical that you
save your macros in the above spreadsheet when you first create the macro (via View->Macros in the Excel ribbon). DO NOT save it in "All Open workbooks". Doing the latter will save your macro in another spreadsheet that is local to your computer. (This means that when your marker downloads your submission the code will not be available and you will receive a zero).Figure 1
: Save your program in the starting spreadsheetBecause your macros will be included in the spreadsheet, when it comes time to submit your work you can just upload the macro-enabled spreadsheet. Double check that your VBA macro really is in the Excel spreadsheet that you upload! It is up to you to do the check, don't rely on us to do it for you. If you want to be extra safe (and I highly recommend that you do this) you can copy paste your VBA program into a regular Word document such as the [document provided] and submit the Word document (containing your VBA program in the body of the Word document) as well as your macro-enabled spreadsheet (containing your VBA program accessible via the Visual Basic editor).
It would be a good idea to check your submission by downloading what you uploaded into D2L and actually open that spreadsheet, ideally on a different computer that the one you used to write your VBA program (to help ensure that you aren't looking at a local file on the first computer which you used to write the program). As was the case with the assignments do not use other compression utilities (such as zip), otherwise your submission may not be marked.
Write an Excel VBA program that will count the number of visitors to the town "Tamville". Your program will determine the total number of visitors on a per month basis and show this information in the form of a popup for each month where visits occurred. In the '2018' visits only occurred in December (when the town opened for tourism). In the '2019' worksheet visits occurred in every month except May & September. Information about the total number of visitors (whole year) will be written into the spreadsheet itself (Cell 'F1').
Your program will implement the features below on the currently active worksheet. While you can use the data in the two worksheets to test your submission your program must be able to work with any worksheet that contains visitor data in this format. To be blunt: Your solution
cannot be tailored to work only with the cases in the starting spreadsheet (e.g. 33 rows of visitor data, exactly 4 days where visitors came into town in January etc.)To help you test and debug the program Column '
D' contains the information that your program is to tabulate.Features of your program:
Feature 1: Writes the hard-coded text "Total yearly visitors=" to cell E1 using the Cells or Range object. (Worth 0.1 GPA) [Example] | ||
Feature 2: Correctly writes the total number yearly visits to Cell F1 (Requires Feature 3A to be correct for credit to be awarded) (Worth 0.2 GPA) [Example] | ||
Feature 3: Correctly counts the total number of visitors for each month and displays the count using a MsgBox: | ||
Feature 3A: Uses a loop to step through each non-empty row in the worksheet. (Worth 1.0 GPA) | ||
Feature 3B:
Uses a loop nested inside of the one written for Feature 3A to step through the
visits for a month. This loop repeats the process (or reruns from start to end
for each month where visits have occurred). In the starting spreadsheet the
nested loop for Feature 3B will run 10 times for the 10 months for the 2019 year
and once for the 2018 year. The number of times the nested loop runs for each of
those 10 months varies depending upon the number of entries for that
month e.g. Jan. 2019 it runs 4 times, Feb. 2019 it runs twice. Obviously this feature requires Feature 3A to be
complete and correct. (Worth
1.2 GPA)
An alternative (which can also be awarded full credit) to nesting a loop within a loop for 3B is to nest a branch within loop. [Example program] |
||
c.
Feature 3C:
The nested loop (or nested branch) from 3B is used to count and display
the visits for each month via popup
MsgBox.
Obviously requires Feature 3B to be complete and correct.
(Worth 1.5 GPA)
[Example running with worksheet '2018' as the
active one]
The same information to be shown in the popups is the same as results from the Excel SUM function shown in Column 'D'. The information is shown in that column to help you check the results of your program. |
Although you won't be graded on documentation for exercises it still would be a good idea to include it so you don't miss it in the assignment. What's needed for assignments include: your full name as provided to the university (make sure it matches, don't include 'nicknames'), student identification number, tutorial number and (new for A4) some evidence of a versioning system (as covered in the [Intro to VBA programming] notes. Within the version you should clearly specify what features of the assignment that you completed or didn't complete. In order to get credit the documentation has to be clear and complete
Similar to documentation requirements you aren't graded for style for workbook exercises but it would be a good idea to still follow those requirements so you get in the habit of doing this.
Assignments must reflect individual work; group work is not allowed in this class nor can you copy the work of others. Some "do nots" for your solution: don't publically post it, don't email it out, don't show it to other students, don't get help with your assignment from a tutor (if you have hired one). For more detailed information as to what constitutes academic misconduct (i.e., cheating) for this course please read the following [link].
Submission received: |
On time |
Hours late : >0 and <=24 |
Hours late: >24 and <=48 |
Hours late: >48 and <=72 |
Hours late: >72 and <=96 |
Hours late: >96 |
Penalty: |
None |
-1 GPA |
-2 GPA |
-3 GPA |
-4 GPA |
No credit (not accepted) |