Lab #1 Solution

$29.99 $18.99

Introduction The goals of these lab exercise are: To give you practice designing a class. Object-oriented analysis was discussed in last week’s lectures, and there is an exercise on designing and building a Point class. To give you practise implementing a class. This will make you review lots of the material from CSC108: creating simple…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

Rate this product

Introduction

The goals of these lab exercise are:

  • To give you practise implementing a class. This will make you review lots of the material from CSC108: creating simple classes, writing methods, and basic data structures in Python.

  • To make people practice the function design recipe, especially students who have not used it in a previous courses. The function design recipe was used in class last week. It is a strategy for writing functions that makes them easier to write correctly and leaves behind an excellent docstring.

  • Use standard Python style. You should consult CSC108 style guidelines and pep 8. In CSC148, we follow pep 8, and not CSC108, style in preferring to use parentheses for long lines. We also don’t leave a blank line between the docstring and the function body (the syntax highligher e
    ectively distinguishes these elements).

In addition, this lab will make sure that:

  • students who have not used the PyCharm IDE get familiar with it, or the IDE they plan to use in this course, and

Don’t hesitate to make use of other resources, such as course notes or How to Think Like a Computer Scientist to read up on any topic that you’ve forgotten about.

Start on these early so that you’ll have plenty of time to talk to a TA or ask other students if you get stuck, and please be generous in helping others.

Getting started with Pycharm

  1. Log in to your teach.cs account.

  1. Follow the instructions to congure Pycharm, and create a csc148 directory structure for your work. Do not try to install PyCharm on teach.cs | it’s already there, under the menu for First Year teach.cs. Although we recommend PyCharm, you are allowed to use any IDE you want in this course. In what remains, we will refer to your IDE, rather than PyCharm.

  1. Download the le specs.txt and save it in the lab1 subdirectory you created above.

  1. Open the \le specs.txt in your IDE. This is the speci

cation for the code you have to write in the rest of this lab.

Designing a class

  1. Create a new le called lab1.py.

  1. Perform an object-oriented analysis of the specications in specs.txt, following the same recipe we used in class for Point:

    1. choose a class name and write a brief description in the class docstring.

2