eecs 233 hw1b

eecs 233 hw1b - things. Integers which are too large also...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
EECS 233 / Summer 2006 Homework 1b Design Document Benjamin Horstman The assignment was to implement the throttle class discussed in Chapter 2 of the textbook. Although I am technically a Java student, I already implemented the throttle class as C++ practice, so I will turn in the C++ version. The class, implementation file, and application with main method all compile as a console application using MS VC++ 2005. I implemented the throttle class in a similar manner, adding a member function which returns the top_position of the throttle. As in the example, the shift method will not shift the throttle higher than top_position or lower than 0. The application instantiates two instances of throttle objects. Each of the constructors is utilized; one constructor receives its argument from cin. As in assignment 1a, this input isn’t check for validity (I don’t know how), and passing non integers breaks
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: things. Integers which are too large also do not work. I want to allow the user to set the position of the throttle to an arbitrary position, say the fifth one. Before I do this, I should shut the throttle off so I can shift up the required number of positions from zero. This isnt strictly necessary in my code (I only do this when the throttle is already 0), but could be an issue later. I check whether or not the throttle is on merely to taunt the user if it is zero. There is no functional reason to do this. The two throttles are then shifted until the user defined throttle is at maximum flow. The generically constructed throttle immediately reaches its maximum flow of 1. The flow of the throttles is printed once every iteration of the loop....
View Full Document

Ask a homework question - tutors are online