SENG265 a4 art writeup v7

Assignment 4 – V7 SENG265 Summer 2023
Programming environment
Assignment 4 ― V7
Due date: Friday, July 28, 11:59 pm Submission via Git only
For this assignment you must ensure your code executes correctly on the reference platform (i.e., computers on ELW B238, which can be accessed using ssh) you configured as part of Lab 01. This same environment will also be used by the teaching team when evaluating your submitted work. You will have to make sure that your program executes perfectly on the reference platform. If your programs do not run on reference platform, your submission will receive 0 marks.
All test files and sample code for this assignment are available in the ‘a3’ folder of your git repository and you must use the git pull command to download a copy of the files: git pul
Individual work
This assignment is to be completed by each individual student (i.e., no group work). You are encouraged to discuss aspects of the problem with your fellow students. However, sharing of code fragments is strictly forbidden. Note SENG 265 uses highly effective plagiarism detection tools to discover copied code in your submitted work. Both, using code from others and providing code to others, are considered cheating. If cheating is detected, we’ll abide by the strict UVic policies on academic integrity: https://www.uvic.ca/library/help/citation/plagiarism/
Learning objectives
I. Learn how to generate web pages or how to generate programs using Python ― generate HTML and SVG code programmatically.
II. Learn object-oriented design with PART-OF or aggrega􏰀on hierarchies ― using Python classes, objects, and attributes (methods and data) to represent hierarchical HTML and SVG code.
III. Appreciate the software engineering concepts of abstraction, encapsulation, and separation of concerns.
IV. Learn how to structure Python projects into mul􏰀ple files ― modules.
V. Learn and appreciate Python type hinting.
VI. Learn how to understand application programmer interfaces (APIs).
VII. Learn how to generate random numbers in Python ― random numbers are frequently employed in algorithms, simulations, and quantum computing.
VIII. Learn how to manage sequential text files using the Python file I/O API.
IX. Learn to write Pythonic code using namedtuple.
X. Practice incremental software development.
XI. 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 lose your work.
Instructions
Assignment 4 consists of three (3) separate Python projects. The idea is to develop the famous SENG 265 Python Arts program incrementally for Part 3 of Assignment 4. 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,

Assignment 4 – V7 SENG265 Summer 2023
a42, a43 of the a4 directory. This assignment should be a lot of fun. Show your generated art to your family and friends.
Concentrate on learning object-oriented programming in Python, including the concepts of classes, objects, properties, instance variables, instance methods, class variables and class methods, and single inheritance. Experienced Python developers write Pythonic code which is a core skill for Python developers. In this assignment, you will level up that skill using namedtuple and NamedTuple. With the factory method namedtuple(), you can create immutable sequence types that allow you to access their values using descriptive field names and the dot notation instead of unclear integer indices. With NamedTuple you can create subclasses that inherit namedtuple properties.
Core components of this assignment include incremental development and Git version control. These software engineering skills are critical for substantial software projects and distributed development in teams.
For Part 1 develop an object-oriented Python project to generate a simple HTML-SVG document (i.e., a web page) as depicted in Figure 1 below. The generated file can be viewed using your favorite web browser by rendering the SVG drawing depicted in Figure 2 below.
A starter program is provided for Part 1. However, this program is not written in an object-oriented style. So, a first step is to decompose the problem into classes including attributes (i.e., instance variables and methods). Please note that there are many different solutions to writing Part 1 in object-oriented style. The following class decomposition is one viable approach. Practice incremental development from the start and use Git for managing the incremental development.
1. Develop a Python class called HtmlDocument to generate an HTML page consisting of a header and a body as shown in Fig. 1 below.
2. Develop a Python super class called HtmlComponent to render an HTML component. Then use single inheritance to inherit the properties from HtmlComponent.
3. Develop a Python class called SvgCanvas to generate the , tags for the SVG drawing in an SVG canvas or viewport (cf. Fig. 1). This class should include a method called gen_art to generate the art (i.e., circles) in the SVG canvas. This functionality also be part of the HtmlDocument class.
4. Develop Python classes called CircleShape, RectangleShape, EllipseShape to draw circles, rectangles, and ellipses using the SVG , and tags, respectively, as depicted in Fig. 1 (only circles are depicted in this figure). Thus, these classes include circle, rectangle, and ellipse instance attributes and methods to draw these SVG shapes. The CircleShape class is sufficient for Part 1. However, the Circle and RectangleShape classes are required for Part 3. The EllipseShape class is optional for Part 3.
5. Write the generated HTML and SVG code to a text file (i.e., not to standard output).
6. Then view the generated HTML page (e.g., part1.html) using your favorite web browser.
7. Use namedtuple and NamedTuple as discussed in class fo ease of readability and maintenance of your code.

Assignment 4 – V7 SENG265 Summer 2023
Figure 1: Generated HTML/SVG code
Figure 2: Sample HTML/SVG page
Part 2 generates a table of random numbers as depicted in Table 1 below. The idea is to generate random numbers to produce random art. The hardwired numbers for the circle center, radius, and color in Fig. 1 will be replaced by random numbers in Part 3 of this assignment. Table 2 contains a set of ranges for random number generation for the different variables (e.g., radius, width, height, color, or opacity).
1. 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. Use f-strings to generate each row in nicely aligned (right-justified) columns.
2. Develop a Python class called PyArtConfig to define ranges for the different parameters of the generated random art. For example, generate art with big or small circles and rectangles; or art with certain color shades (see images below). Use default values and keyword arguments in the __init__ constructor of PyArtConfig.

程序代写 CS代考 加微信: cstutorcs
Assignment 4 – V7 SENG265 Summer 2023
Define the default ranges (e.g., minimum and maximum color values) as class variables in the PyArtConfig
3. Develop a Python class called RandomShape that generates a random shape according to the art style (i.e., a
PyArtConfig object) specified. This class features three methods: __str__(), as_Part2_line, and as_svg(). __str__() returns a string of the object data nicely formatted over multiple lines. as_Part2_line () returns a string of the object data in the form of a line of numbers as depicted in in Table 1. Finally, as_svg() returns a string of the object data in the form of SVG commands.
Table 1: Random numbers for 10 sample geometric shapes
Table 2: Random numbers for 10 sample geometric shapes
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 (i.e., object of the HtmlDocument class). That is, Projects 1 and 2 are steppingstones for the various classes required for Part 3.

CS Help, Email: tutorcs@163.com
Assignment 4 – V7 SENG265 Summer 2023
Instantiate at least three configuration class objects to generate different art types as depicted in Figure 3 below. Show your artistic side. Image titles and captions (e.g., postcard greetings) are optional.
Figure 3: SENG 265 ART
Important requirements for grading
 The Python code for all three parts must be your own work and cannot be generated Python code.
 The most important requirement is effective object-oriented design and effective program decomposition
for the three parts.
 You must use classes and objects for geometric objects (i.e., CircleShape, RectangleShape), art and
shape configuration (i.e., PyArtConfig and RandomShape) as well as HTML-SVG class (i.e.,

程序代写 CS代考 加QQ: 749389476
Assignment 4 – V7 SENG265 Summer 2023
HtmlDocument). It is helpful to model IS-A hierarchies of html components and geometric shapes using
Python’s single inheritance mechanism.”  To facilitate automated grading
o the following class names are required for the required classes: CircleShape, RectangleShape, PyArtConfig, RandomShape, and HtmlDocument, and HtmlComponent
o each class and each method must have a docstring containing the class or method name (e.g., “““CircleShape class””” or “““drawCircle() method”””) right below the class or function header
o all three projects must have a main() function and an if __name__ == “__main__”: block
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 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 generated HTML files (a431.html,
a432.html, and a433.html) and their corresponding 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 (i.e., PEP 008). Using random or single character variables is considered improper coding and significantly reduces code readability. Single character variables as loop variables is fine. Please note knowledge of PEP 008 is expected for the final exam of this course.
• Proper indentation for generated HTML/SVG code: the generated HTML/SVG code must be properly indented according to the nesting of and tags.
• 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.