10. Objects
Feel free to use your laptop
You are strongly encourage to work with others
When you get stuck, ask those sitting around you for help
Get used to working together in the labs
Peer teaching and peer learning has been empirically shown to be very effective
10.1. Pre Lab Exercises
10.2. Before Kattis
Create a
SquareclassSingle attribute
side_lengthThe constructor will take a parameter for specifying the size
Method for calculating
area()Method for calculating the
perimeter()Make instances of the class and write
asserttests to verify correctness
Create a
RectangleclassAttribute for
lengthAnother attribute for
widthThe constructor will take two parameters for specifying the size
Method for calculating
area()Method for calculating the
perimeter()Make instances of the class and write
asserttests to verify correctness
Create a
RectangularPrismclassAttributes for
length,width, andheightThe constructor will take three parameters for specifying the size
A method for calculating
surface_area()A method for calculating
volume()Make instances of the class and write
asserttests to verify correctness
10.3. Kattis Problems
You should be using a scrap piece of paper to work out the ideas for the following problems
The problems you are to solve are getting too complex to try to solve by just coding
Trying to solve problems by just typing away will not yield success