logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Philip BirnbaumAccounting
(5/5)

823 Answers

Hire Me
expert
Shankar GhoshalData mining
(5/5)

555 Answers

Hire Me
expert
Colleen LanclosLaw
(4/5)

791 Answers

Hire Me
expert
Martinha RosaFinance
(5/5)

943 Answers

Hire Me
Python Programming

In this assignment, you'll create a program that combines modules and classes. The classes will be created in separate files, shape.py and circle.py.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

1.  Reading and Study

Week 4's's's reading

How to write code to test your modules Before you start writing your program:

Study and understand the Shape class described on page 33.

Study and understand the Circle class described on in section 15.5.2 (p. 215).

super()

Lab files

Download The Shape and Circle modules designed for this assignment. These modules are modifications of the Circle and Shape classes shown in The Quick Python Book/These two files have a /.txt file extension that you'll have to remove to make them .py files.

In this assignment, you'll create a program names lab4.1.py that combines modules and classes. The classes will be created in separate files, shape.py and circle.py. To complete this problem you will be writing several methods in the shape.py and circle.py.

The final exam will contain a question about classes and modules

When you write lab4.1.py, you will import the Shape and Circle classes into your program. Your lab4.1.py program will generate plain text output that is organized and readable by the grader (me!).

Summary

lab4.1.py uses two classes, Shape and Circle. The Circle class is a subclass of
Shape.
The shape.py file is a module that contains the Shape class, the parent class of geometric shapes such as Circle.
The circle.py file is a module that contains the Circle class, which is a subclass of
Shape. As a subclass, Circle must import shape.py.

lab4.1.py will:

Import the shape.py and circle.py modules. Create two Circle objects.
Move the two circle objects around the x,y co-ordinate system by changing their x and y
coordinates.
Determine whether the circles overlap, or "collide" with each other. "Collide", in this assignments, means that the two circles occupy the same point at the same time. That is to say, if the two circles intersect, they are colliding. This faux animated example will help you visualize how your script will generate a series of circles and report whether they are colliding. This example is really a series of HTTP requests, one for each movement of the two circles.

Example output

Your script should display your program's data as well-formatted, readable, human-friendly plain text, as in the plain text example below. If you're feeling ambitious, you might want to try writing a CGI script that will format the output using HTML.

Your script should create plain text output.

Plain text output of lab4.1.py

TODO Complete the shape.py module

Download shape.py

The Shape class in shape.py is almost complete. The location() method needs to be completed. You'll see it indicated like this.

########################################## # TODO TODO TODO --- COMPLETE THIS METHOD ##########################################

def location(self):

'''Returns a tuple containing the (x,y) coordinates of a Shape object

When writing your code, you have to replace "pass" with your code.''' pass

init (), a class constructor what sets an objects x,y coordinates. Completed

move(), a method to move objects to new x,y coordinates. Completed                                                                                       

location(), a method that returns a tuple containing an object x,y coordinates. You have to complete this method. This method will be inherited by any subclasses.

The Shape class provides methods to set a shape's x,y coordinates, to move the shape to a new set of coordinates, and to report the shape's location as a tuple containing the object's x,y coordinates. You have to complete the location() method.

Here's some code to get you started on shape.py. It's based on the source code for the Shape

class on p. 30 of The Quick Python Book.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme