C++ Lecture 5 - C+ Lecture 5

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

View Full Document Right Arrow Icon
http://www.cs.mun.ca/~gstarkes/3710/c++/lecture5.html 1 of 6 4/13/2009 5:28 PM C++ Lecture 5 [Previous Lecture] [Lecture Index] [Next Lecture] Objective of (OO) Design To handle complex problems (easily). Design programs so they are: easy to implement easy to understand easy to maintain Problems are complex because: there are many parts to the problem the parts interact (the interactions can become complex) Problem solved by creating well defined parts (objects) `well defined' means: a minimal external interface (what can be done with an object) is explicitly specified implementation details are hidden making objects as self contained as possible Possible Bonus: more likely to create re-usable code Example Problem Write a program that simulates the transport system in a factory. The transport system consists of segments of fixed track called `channels' which are always parallel to the X-axis, `shuttles' which move on the channels, stretches of fixed track called `rails' which are always parallel to the Y-axis, and groups of moving channels called `magazines' which move on the rails. Each channel has one or more motors: the motors drive a gear which, in turn, will move a shuttle that is under the gear. Each magazine has a motor which moves it along the rails. Motors have two control lines: one that causes the motor to turn forwards, and one that causes it to move backwards. They also have a `tooth sensor' output line: the line is high when a tooth of the gear is over the sensor. Each motor is connected to a common interface bus, and has a unique bus address. Given a factory layout and a set of bus inputs (and an associated time for each input), the program is to display the factory on the screen, showing any movements generate signal outputs (for motor) detect any problems that may occur, e.g., shuttles colliding shuttles falling off channels
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

C++ Lecture 5 - C+ Lecture 5

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

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