CPSC 217 Assignment 1 Solved

$ 20.99
Category:

Description

Weight: 6%

Individual Work:
Late Penalty:
Late assignments will not be accepted.
This assignment includes two parts. The first part requires you to write a computer program using Python. Your program must be submitted electronically. Use the Assignment 1 drop box in D2L for the electronic submission. No paper submission is required for the first part.
Posting Submissions for Public Viewing:
In previous years, we have received many creative and highly artistic submissions for the first part of this assignment. As such, we plan to post the images that are created on the course webpage so that others can view them. Your image will be posted anonymously, unless you choose to include your name as part of the image that you create. If you are not willing to have your image included on the website then please send an email to ben.stephenson@ucalgary.ca clearly stating such.
Part 1: Creating a Graphical Python Program
In this part of the assignment, you will create a small graphical Python program. The program will take two integers as input from the user. Its output will be a “smiley” (loosely defined) centered on the position specified by the user. For example, if the user enters 400 and 300 as input then the face should be centered in the window. If the user enters 0 and 0 then the face should be centered in the upper left corner of the window, with part of it cut off by the edge of the window. Use the SimpleGraphics library that you were introduced to previously to complete this task.
Getting Input:
Read your input using the techniques that we have discussed in class. Display a prompt in the terminal window with a print statement, or by providing a parameter to the input function. Note that the user will enter their input in the terminal window, not in the graphics window.
Recommended Algorithm:
1. Import the SimpleGraphics library
2. Prompt the user to enter the x-position by displaying a message in the terminal 3. Read the x position from the user as a number
4. Prompt the user to enter the y-position by displaying a message in the terminal
5. Read the y position from the user as a number
6. Draw the face by calling functions in the SimpleGraphics library. These function calls will likely include calculations involving x and y
Additional Specifications:
Ensure that your program meets all of the following requirements:
• The image generated by your program should be some sort of a face that uses most of the drawing area.
• The image generated by your program must use a total of at least 4 distinct colors.
• The image generated by your program must use a total of at least 4 different graphics primitives such as ellipses, polygons, rectangles, text, etc.
• Do not resize the window.
• Your program should read only two input values – the x-position and the y-position of the center of the face.
• Your program must include appropriate comments, including a comment at the top of your file which includes your name and student number and describes the purpose of your program. There should also be comments within the program that indicate which lines of code draw different parts of the face (eyes, nose, hair, ears, mouth, etc.).
• You do not need to replace numbers used to control the positions of shapes with named constants.
• Do not display your student number as part of the image.
Part 2: Information and Data
Solve the following problems, and submit your answers on paper. It is not necessary to type your answers as long as your work is neat and easy to read. An electronic submission is not required for this part of the assignment.

1: [5 marks] Convert the following base 10 numbers to binary:
a) 86
b) 763
c) 3667
d) 27538
e) 82917373

2: [5 marks] Repeat question 1, converting each base 10 value to base 8:

3: [5 marks] Repeat question 1, converting each base 10 value to hexadecimal:

4: [5 marks] Repeat question 1, converting each base 10 value to base 5:

5: [5 marks] Convert the following base 2 numbers to decimal:
a) 10111
b) 111010
c) 1010110
d) 10101101111
e) 1011100110111011110

6: [5 marks] Convert the following numbers:
a) 3232 base 4 to base 10
b) 2754 base 8 to base 10
c) 100 base 16 to base 10
d) 100 base 7 to base 10
e) 7654 base 8 to base 10

7: [8 marks] Convert the following numbers:
a) E2 base 16 to base 6
b) 1111001111 base 2 to base 3
c) BAD base 14 to base 20
d) 5345 base 6 to base 16

8: [12 marks] Answer the following questions. Your response to each question should be brief (three sentences or less).
a) In ASCII, what value represents the letter A?
c) In ASCII, what value represents the letter w?
e) In ASCII, what value represents the character ‘7’?
g) In ASCII, what value represents the character ‘+’?
i) What is UTF-8?
j) What advantages does UTF-8 have compared to ASCII?
k) What disadvantages does UTF-8 have compared to ASCII?
l) Why are floating point numbers only an approximation of real numbers?
Grading:
The total mark achieved for the assignment will be translated to a letter grade using the following table:
Mark Letter Grade
100+ A+
95 to 99 A
90 to 94 A-
87 to 89 B+
83 to 86 B
80 to 82 B-
77 to 79 C+
73 to 76 C
70 to 72 C-
65 to 69 D+
60 to 64 D
0 to 59 F

A: Excellent – Superior performance showing a comprehensive understanding of the subject matter

B: Good – Clearly above average performance with generally complete knowledge of the subject matter

C: Satisfactory – Basic understanding of the subject matter

D: Minimal Pass – Marginal performance; Generally insufficient preparation for subsequent courses in the same subject

F: Fail – Unsatisfactory performance

Reviews

There are no reviews yet.

Be the first to review “CPSC 217 Assignment 1 Solved”

Your email address will not be published. Required fields are marked *