Computer Science I for majors by James Tam

Return to the course web page

CPSC 231: Assignment 1

Due at 4 PM. For assignment due dates see the main schedule on the course webpage.

New Concepts to be applied for the assignment

Part I: Introduction to UNIX, using common commands (Each of the graded steps in this part is worth 0.1 grade point (GPA) x 9 steps = 0.9 GPA)

On the UNIX/Linux 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. In to make marking reasonable for your TA make sure that you complete each step exactly as-is and in same order as specified below. If you deviate from either requirement then you may end up with few (if any) marks.

  1. Login to your UNIX account*

  2. Start a script session *

  3. Show your location (path) in the UNIX file system.

  4. Show the contents of your current directory (your home directory)

  5. Go to the official course directory for CPSC 231 Assignment 1 (/home/231/assignments/assignment1)

  6. Show the contents of your current directory (official A1 course directory)

  7. 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]

  8. Copy the 'index.txt' file to your home directory

  9. Return to your home directory

  10. Show the contents of the your home directory.  (It should include the file 'index.txt' now.)

  11. Delete the 'index.txt' file from your 231 directory [JT's comment: it should work now because it's a directory that you created rather than the course directory]

  12. End the script session*

  13. 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 for each 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 #3 but mostly because you will be including this information in Part II).

Part II: Creating your first Python program (worth 3.1 GPA)

Write a Python program that will calculate a simplified version of the actual calculations used to calculate your term grade. For the assignment you just need to worry about 3 components: assignments (proportion of term grade = 30/100), midterm (proportion of term grade = 30/100), final exam (proportion of term grade = 40/100). You only have to enter a single aggregate value for assignments for simplicity. It's assumed that if you can do the calculation for one that you can do it for several values. If you want to see the full blown grade calculator spreadsheet. An example of the data entry of the values for the three components is shown in Figure 1.


Figure 1: Data entry assumes numeric grade points (range of 0-4)

Note: just like with your actual term grade each component will be awarded a value from 0 - 4.0 GPA. However, your program does not have to error check that the user actually entered a value within this range because you will not yet have yet learned how to do this yet. Just assume that the user enters a value within the correct range. Also your program doesn't have to check for invalid types of information being entered (e.g. the user enters a string instead of numbers for a grade point). You should however document these things as current program limitations.

Finally the program will display the weighted grade points for the assignments, the 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 the image in Figure 2). 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 (very top in the form of Python documentation). Finally your prompts to the user to enter the required information should be clear to the user as to what is required.


Figure 2: Display of weighted grade points


Figure 3: Display of the overall term grade point

D2L configuration:

Marking

Points to keep in mind:

  1. Due time: All assignments are due at 4 PM on the due dates listed on the course web page.  Late assignments or components of assignments will not be accepted for marking without approval for an extension beforehand. Alternate submission mechanisms (non exhaustive list of examples: email, uploads to cloud-based systems such as Google drive, time-stamps, TA memories) cannot be used as alternatives if you have forgotten to submit work or otherwise have not properly submitted into D2L. Only files submitted into D2L by the due date is what will be marked, everything else will be awarded no credit.
  2. Extensions may be granted for reasonable cases by the course instructor with the receipt of the appropriate documentation (e.g., a doctor's note). Typical examples of reasonable cases for an extension include: illness or a death in the family. Example cases where extensions will not be granted include situations that are typical of student life: having multiple due dates, work commitments etc. Tutorial instructors (TA's) will not be able to provide extension on their own and must receive permission from the course instructor first.
  3. Method of submission: You are to submit your assignment using D2L [help link]. Make sure that you [check the contents of your submitted files] (e.g., is the file okay or was it corrupted, is it the correct version etc.). It's your responsibility to do this! (Make sure that you submit your assignment with enough time before it comes due for you to do a check).
  4. Identifying information: All assignments should include contact information (full name, student ID number and tutorial section) at the very top of your program in the class where the 'main()' method resides (starting execution point). (Note other documentation is also required for most assignments).
  5. Collaboration: Assignments must reflect individual work; group work is not allowed in this class nor can you copy the work of others.  For more detailed information as to what constitutes academic misconduct (i.e., cheating) for this course please read the following [link].
  6. Execution: programs must run on the computer science network running Python 3.x. If you write you code in the lab and work remotely using a remote login program such as Putty or SSH then you should be okay (assuming you don't login to a non-Linux computer). If you choose to install Python on your own computer then it is your responsibility to ensure that your program will run properly here. If it's not running in the lab computers using Python 3.x then it won't be awarded credit. It's not recommended that you use an IDE for writing your programs but if you use one then make sure that you submit your program in the form of text ".py" file or files.
  7. Use of pre-created Python libraries: unless otherwise told you are to write the code yourself and not use any pre-created functions. For this assignment the usual acceptable functions include: print(), input() and the 'conversion' functions such as int(), float(), str(). Look at the particular assignment description for a list of other classes that you are allowed to use and still get credit in an assignment submission.