Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Microsoft Word - a4-writeup.docx Assignment 4 SENG265 Summer 2022 1 Assignment 4 Due date: Friday, July 29, 11:59 pm Submission via Git only Programming environment For this assignment you must ensure...

1 answer below »

Microsoft Word - a4-writeup.docx
Assignment 4 SENG265 Summer 2022
1
Assignment 4
Due date: Friday, July 29, 11:59 pm
Submission via Git only

Programming environment
For this assignment you must ensure your work executes co
ectly on the virtual machines (i.e., Senjhalla or its
analogous environment for students with M1 MacBooks) you installed/configured as part of Assignment 0 as this
is our “reference platform”. This same environment will be used by the teaching team when grading the work
submitted by the SENG 265 students. Submitted assignment that don’t execute co
ectly on the required
environment will receive a failing grade or be subject to heavy penalties.
The sample code for Part 1 of this assignment is available on Brightspace as well as on the ‘a3’ folder of your
git repository and you must use the git pull command to download a copy of the files. Make sure that
your submitted files are inside of your a4 folder of your cloned Git repository.
Hint: To verify whether you uploaded the files properly, simply clone the git repository to a new directory on
your computer and check that the desired files are placed properly.
Individual work
This assignment is to be completed by each individual student (i.e., no group work). Naturally you will want to
discuss aspects of the problem with fellow students, and such discussion is encouraged. However, sharing of
code fragments is strictly fo
idden. Code-similarity analysis tools are used to check submitted work for
plagiarism.
Learning objectives
I. Learn object-oriented design with Python ― using classes, objects, and attributes (methods and data).
II. Appreciate the concepts of abstraction and encapsulation
III. Learn how to structure Python projects into multiple files ― packages and modules.
IV. Learn Python type hinting
V. Learn how to generate random numbers in Python
VI. Learn how to manipulate sequential text files using functions in Python
VII. Learn how to understand application programmer interfaces (APIs)
VIII. Learn how to generate HTML5 and SVG code programmatically
IX. Learn top-down design using function decomposition
X. Appreciate how you can configure Python programs with a configuration class.
XI. Continue to learn incremental development. The starting point for A4 is a complete Python program. You
need to study and understand this program to complete the assignment.
XII. Learn how to read and understand existing code and build upon it.
XIII. Use Git to manage changes in your source code and annotate the evolution of your solution with
messages provided during commits. Update your git repository after every major editing session to make
sure that you don’t loose your work.
Assignment 4 SENG265 Summer 2022
2
Instructions
Assignment 4 consists of three (3) separate Python projects. The idea is to develop the famous SENG 265
Python Arts program incrementally. All three parts are required. The first two parts are worth 20% each and Part
3 is worth 60%. Store the three different Python projects in three subdirectories called a41, a42, a43 of the a4
directory.
Part 1
The purpose of Part I is to figure out the process of writing an HTML/SVG file and viewing this file in a web
owser. So in Part 1 you are to develop an object-oriented Python project that features a Circle class and
generates an HTML-SVG file as depicted in Figure 1 below. Viewing this file in a web
owser will render the
SVG drawing depicted in Figure 2 below. Start Part 1 by downloading this sample Python program provided and
modify this program as follows. Create classes for the geometric objects (i.e., Circle (provided), Rectangle) as
well as a class called ProEpiloge to generate the HTML/SVG prologue and epilogue. The class names
Circle, Rectangle, and ProEpilogue are required for Part 1 for automated grading. Part 1 must generate
and draw circles and rectangles (e.g., at least 20). Please note that there are no random numbers
equired for Part 1 (i.e., you can hardwire in your code all the numbers that appear in Fig. 1
elow).
Figure 1: Generated HTML/SVG code



Figure 2: Sample HTML/SVG page
Assignment 4 SENG265 Summer 2022
3




Part 2
Part 2 generates random numbers using a class called GenRandom (cf. Table 1) for generating random art using
an art range configuration class called ArtConfig (cf. Figure 3) that can be instantiated to create different art
types such as the images depicted in Figure 3 below. The output of Part 2 must be a table of random numbers as
depicted in Table 1 below. Please note that not all columns are required for Part 3 but are required for Part 2.
Also note that the random numbers you generate will of course be different than the numbers in Table 1.
However, the random numbers should be within the ranges specified in Table 2 below. The numbers should be
a
anged in nicely aligned (right-justified) columns. There are no requirements with respect to white space. The
class names GenRandom and ArtConfig are required for Part 2 for automated grading.
Table 1: Random numbers for 10 sample geometric shapes


Table 2: Random numbers for 10 sample geometric shapes
Assignment 4 SENG265 Summer 2022
4


Part 3
The goal of Part 3 is to integrate the classes developed for Parts 1 and 2 into a third Python project and
generate some beautiful greeting cards for your friends and family in the form of HTML-SVG pages. That is,
Projects 1 and 2 are test programs for the various classes required for Part 3. Instantiate three configuration class
objects to generate different art types as depicted in Figure 3 below. Image titles and captions are optional. All
the class names required for Parts 1 and 2 are required for Part 3.

Figure 3: SENG 265 ART
Assignment 4 SENG265 Summer 2022
5
Important requirements for grading
 Your Python projects must execute perfectly under the Senjhalla virtual machine.
 The most important grading requirements are effective object-oriented design and effective program
decomposition.
 You must use classes and objects for geometric objects (i.e., Circle, Rectangle), art configuration (i.e.,
ArtConfig) as well as HTML-SVG prologue and epilogue (i.e., ProEpilogue)
 To facilitate automated grading
o the following call names are required for the required classes: Circle, Rectangle, ProEpilogue,
ArtConfig, and GenRandom
o each class and each method must have a docstring containing the class or method name (e.g.,
“““Circle class””” or “““ drawCircle method”””) right below the class or function
header
o all three projects must have a main() function
o for Projects 1 and 3, generate valid, multi-line, and indented HTML-SVG files
o all three projects must use Python type hints.
o all three projects must include at three useful doctests (e.g., cf. Exam C solutions)
o for all three projects, global, program-scope, or file/module-scope variables must not be used.
What to submit
 Submit all three parts in separate directories/folders to your a4 folder of your Git repository as follows.
 The three different Python projects must be stored in three subdirectories/folders called a41, a42, a43
that are in your a4 directory.
 Hint: To verify whether you uploaded the files properly, simply clone the git repository to a new
directory on your computer and check that the desired files have been placed properly.
 Part 1: Submit your Python program (a41.py) as well as the generated HTML file (a41.html)
 Part 2: Submit your Python program (a42.py) as well as a screenshot of your random table (a42.jpg)
 Part 3: Submit your Python program (a43.py) as well as three screenshots of your art (a431.jpg, a432.jpg,
and a433.jpg)
Grading assessment
 The first two parts are worth 20% each and Part 3 is worth 60%.
 Straying from the assignment requirements will result in zero marks due to automated grading.
Additional Criteria for Qualitative Assessment
• Documentation and commenting: the purpose of documentation and commenting is to write information so
that anyone other than yourself (with knowledge of coding) can review your program and quickly understand
how it works. In terms of marking, documentation is not a large mark, but it will be part of the quality
assessment.
• Proper naming conventions: You must use proper names for functions and variables. Using random or single
character variables is considered improper coding and significantly reduces code readability. Single character
variables as loop variables is fine.
• Debugging/Comment artifacts: You must submit a clean file with no residual commented lines of code or
unintended text.
• Quality of solution: marker will access the submission for logical and functional quality of the solution. Some
examples that would result in a reduction of marks

#!/us
in/env python
"""Assignment 4 Part 1 template"""
print(__doc__)
from typing import IO
class Circle:
"""Circle class"""
def __init__(self, cir: tuple, col: tuple) -> None:
XXXXXXXXXXself.cx: int = cir[0]
XXXXXXXXXXself.cy: int = cir[1]
XXXXXXXXXXself.rad: int = cir[2]
XXXXXXXXXXself.red: int = col[0]
XXXXXXXXXXself.green: int = col[1]
XXXXXXXXXXself.blue: int = col[2]
XXXXXXXXXXself.op: float = col[3]

def writeHTMLcomment(f: IO[str], t: int, com: str) -> None:
"""writeHTMLcomment method"""
ts: str = " " * t
f.write(f"{ts}\n")

def drawCircleLine(f: IO[str], t: int, c: Circle) -> None:
"""drawCircle method"""
ts: str = " " * t
line1: str = f' line2: str = f'fill="rgb({c.red}, {c.green}, {c.blue})" fill-opacity="{c.op}"
circle>'
f.write(f"{ts}{line1+line2}\n")

def genArt(f: IO[str], t: int) -> None:
"""genART method"""
drawCircleLine(f, t, Circle((50,50,50),
Answered 2 days After Jul 20, 2022

Solution

Aditi answered on Jul 23 2022
74 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here