Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

University of Florida Write the Python Program Computer Science Task

University of Florida Write the Python Program Computer Science Task

University of Florida Write the Python Program Computer Science Task

Description

Write the following Python program in a Python class named Assignment7.pyand upload the

completed program to Gradescope. The goal of this program is to take a collection of rectangles
and display them on a canvas so that none of the rectangles overlap with each other. To
accomplish this task, your program will define several methods and classes. Note: parameters
and return values must be in the order they are listed in the assignment manual

A class CustomCanvas
CustomCanvas will have a constructor which takes two explicit arguments, height and
width, which are expected to be of type int. The constructor will create and display a new Canvas
object with the height and width provided. To do this, you will use Canvas, a builtin object
defined in the python package tkinter. Documentation for the Canvas class can be found here:
https://anzeljg.github.io/rin2/book2/2405/docs/tki…

A class Rectangle
Rectangle will have a constructor which takes four explicit parameters, height, width, x,
and y. All four arguments are expected to be of type int. x and y represent the origin point of the
given rectangle. The origin point will be the upper left corner. Parameters x and y should have
default values of zero. The values received as parameters should be stored in instance variables
of the same name.

A function pack
The pack function will have two parameters, allRect and canvasSize. allRect will be a list
of Rectangle objects and canvasSize a tuple containing a canvas’ height and width (in that order).
pack will take the given list of rectangles and determine a location for each rectangle so that each
rectangle does not overlap another and each rectangle exists within the given canvas size. pack
will then return a list of placed Rectangle objects. Each given rectangle must be included in the
returned list. (Note: Each given rectangle is referring to the logical concept of the rectangle shape
not the specific Rectangle object. Two Rectangle objects are logically equivalent if they have the
same height and width. When generating the list of Rectangles to return, you can modify the
given Rectangle objects or create new, but logically equivalent, Rectangle objects)

A function main
The main function will read in a filepath as a command line argument. You may assume
the filepath is always the second command line argument given (the first being the name of the
class being executed) The given filepath will point to a txt file containing a canvas size and
rectangles. The first line of the given text file will contain two int’s separated by a comma.
These int’s represent a canvas’ height and width (in that order) All following lines represent the
height and width of an individual rectangle. main should parse the data in the file and use the
information to create a new CustomCanvas object and a new list of Rectangles. Once generated, the list of Rectangles and the size of the canvas should be passed to the pack function. Main

should then print each Rectangle contained in the retuned list to the instantiated CustomCanvas
object. Each printed Rectangle should have a black border and a colored (not black or white)
fill. Main should be called whenever Assignment7.py is run as a standalone file but not when
Assignment7.py is loaded as a library.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20