pset9 - MIT OpenCourseWare http/ 6.00...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming Fall 2008 For information about citing these materials or our Terms of Use, visit: .
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6.00: Introduction to Computer Science and Programming Problem Set 9 As If You Needed More Classes Handed out : Thursday, October 30, 2008 Due : Monday, November 3, 2008 Introduction In this problem set, you will be creating and using classes and methods. Along the way, you should become familiar with concepts such as inheritance and overriding methods. Workload Please let us know how long you spend on each problem. We want to be careful not to overload you by giving out problems that take longer than we anticipated. Collaboration You may work with other students. However, each student should write up and hand in his or her assignment separately. Be sure to indicate with whom you have worked. For further details, please review the collaboration policy as stated in the syllabus. Getting Started Add the code you write for this problem set to the following template: For problem 4, use the following sample input file: shapes.txt Problem 1 In this problem set, we will be using classes to encapsulate shapes. We have implemented two different shape subclasses for you, namely Square and Circle . For each of these shapes, we are interested in getting the area (note how the respective area methods override the area method of the Shape superclass), checking for equality, and specifying a string representation of the object. Implement the Triangle class, which also extends Shape . Triangle should have the same methods as the other subclasses of Shape . Other things to note: A Triangle is initialized with a base and height . The string representation for a triangle with base 3.0 and height 4.0 should be: Triangle with base 3.0 and height 4.0 Note: Remember that a double underscore (__) around a method name indicates that the method has special meaning to Python, even though it can be used and overridden like any other method. Python has some special conventions for calling such methods;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/12/2010 for the course EECS 6.00 taught by Professor Grimson during the Spring '08 term at MIT.

Page1 / 6

pset9 - MIT OpenCourseWare http/ 6.00...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online