Computer Science I for majors by James Tam

Return to the course web page

CPSC 231: Assignment 1

Due Friday Sept 30 at 4 PM

Min raw score Grade point
61 4.0
60 3.9
59 3.8
58 3.7
57 3.6
56 3.5
55 3.4
54 3.3
53 3.2
52 3.1
51 3.0
49 2.9
47 2.8
45 2.7
43 2.6
41 2.5
39 2.4
37 2.3
35 2.2
33 2.1
31 2.0
29 1.9
27 1.8
25 1.7
23 1.6
21 1.5
19 1.4
17 1.3
15 1.2
13 1.1
11 1.0
9 0.7
Less than 9 0.0

[Grading spreadsheet]

New Concepts to be applied for the assignment

Part I: Introduction to UNIX, using common commands (30 marks: each graded step is worth 2 marks)

On the UNIX workstations in the Computer Science lab complete the following steps. (JT: creating a typescript file literally records everything: output shown onscreen as well as every character that you type into a text file. Pressing the backspace or delete key will not delete what's recorded into the file, instead that keyboard character will be translated to a gibberish character. If you make a typographical error then DON'T try to delete it during the typescript. Instead just hit enter once or twice - so there will be a few blank lines in the script file - and then re-enter the command properly. Also you will create a directory called '231' under your home directory, this is not the same as the official course directory which is located under /home/231. Don't mix the two up!)

  1. Login to your UNIX account*

  2. Start a script session *

  3. Show the contents of your home directory (2 marks)

  4. Show your location (path) in the UNIX file system (2 marks)

  5. Make a new directory called '231' (2 marks)

  6. Show the contents of your home directory (2 marks)

  7. Go to the official course directory for CPSC 231 (/home/231) (2 marks)

  8. Show your location (path) in the UNIX file system (2 marks)

  9. Show the contents of the official CPSC 231 directory (2 marks)

  10. Go to the directory for the CPSC 231 Assignment 1 (/home/231/assignments/assignment1) (2 marks)

  11. Display the contents of the file called 'index.txt' onscreen (JT's hint for this step: don't try to view it with an editor such as 'emacs' or 'vi'). (2 marks)

  12. Try to delete the 'index.txt' file [JT's Hint: you aren't supposed to be able to complete this step successfully but instead you should get an error message. Take away learning: you only have limited file permissions in the course directory] (2 marks)

  13. Copy the 'index.txt' file to the newly created '231' directory that you created in your home directory (2 marks)

  14. Go to the '231' directory that is located in your home directory (2 marks)

  15. Show the contents of the '231' directory.  (It should include the file 'index.txt' now.) (2 marks)

  16. Delete the 'index.txt' file from your 231 directory [JT's comment: it should work now because it's a directory that you created not the course directory] (2 marks)

  17. Show the contents of the '231' directory.  (The file should be gone now.) (2 marks)

  18. End the script session*

  19. Submit your assignment (the file called "typescript" using D2L as described on the course web page [D2L link]).*

The lines marked with a star '*' don't directly yield any marks but must still be completed in order for Part 1 of the assignment to be marked. You will either receive full marks on a step in Part I or no credit. You don't need to include contact information in the typescript (partly because some of it will be displayed in Step #4 but mostly because you will be including this information in Part II).

Part II: Creating your first Python program (31 marks)

Write a Python program that will calculate your term grade point based on the weights specified in the course admin notes, summary in the following PDF. The program will prompt the user for the grade point for each component and calculate the weighted grade point for that component. Finally the program will display the weighted grade points for the 4 major components: mini assignments, regular assignments, midterm and the final exam. This output must appear at the very end of your program with each weighed grade on it's own line (see image). Weighted grade points should only display two places of precision for the rational component (although all rational digits can be used when performing calculations - no rounding is needed this is just for the formatting of output). All output should be neat and presentable. You should employ good naming conventions for variable names and be sure to include the required contact information (your name, student identification number and tutorial number) in the header of the program. Your program doesn't have to error check the type of input (i.e., if the user enters a non-numeric value by mistake) nor does it have to error check the range (i.e., the person enters a grade point beyond the valid range of values). JT's final hint: don't try to type in the whole program all at once, especially when calculating and displaying all the assignment grades. Try it for just one component, make sure it works before adding the information for the other components.

Submit your assignment (the file containing the grade calculating program using D2L as described on the course web page [D2L link])

Program feature (Part II) Marks
Prompts for each component (8 mini assignments, 5 full assignments, 2 exams): ~0.87 marks each 13
Correctly calculates and displays weighted grades for each component (mini-assignment, full assignment, midterm exam, final exam): 2 marks for each component calculated and displayed 8
Correctly calculates and displays overall term grade point (individual weighted values must be correct) 2
The display of each weighted grade point only shows two rational digits: 5 grades displayed with each output worth 1 mark 5
Required contact information included in the program documentation (name, student identification, tutorial number) 3
Total for Part II 31