$30
Page 1
CS 271/462
Programming Assignment 9
You are expected to read Chapter 17 before beginning this assignment.
40 points total
Submit 4 files (don't zip them):
1. makefile
2. WindTurbine.h
3. WindTurbine.cpp
4. PA9Test.cpp (this is the driver program)
Programs must compile.
Programs that have syntax errors receive a grade of zero.
Your submission will be graded on how well:
the programs follow the course documentation and style guidelines.
the programs follow the conventions for naming variables and functions.
the class definition and implementation match the specifications.
the driver program tests all functions of the class.
These things are prohibited:
scanf and printf
\n and \t
C libraries
"this"
std::
The Assignment
Using what you have learned in previous assignments, implement the class WindTurbine according to the UML and
specifications given below. Test all components of the class thoroughly.
Page 2
UML Class Diagram for Class WindTurbine
WindTurbine
- powerOutput : double
- bladeSpeed: int
- orientation : string
<<constructor>> WindTurbine( p : double, b : int, o : string )
+ setPowerOutput( p : double )
+ setBladeSpeed( b : int )
+ setOrientation( o : string )
+ getPowerOutput( ) : double
+ getBladeSpeed( ) : int
+ getOrientation( ) : string
+ toString( ) : string
Additional specifications:
powerOutput the maximum output of the turbine in kilowatts. Allowed values are 1.0 to 10,000.0.
bladeSpeed the current speed of rotation in rpm (revolutions per minute). (Yes, engineers...this is actually a
frequency.) Allowed values are 0 to 300.
orientation either "vertical" or "horizontal" (case-sensitive). No other values are allowed.
Constructor:
Must have default arguments: 100.0 for powerOutput, 0 for bladeSpeed, and "horizontal" for orientation.
Mutators:
Must ensure that only allowed values are stored in the data members. Ignore invalid values.
toString function:
Must return a string containing a description of the WindTurbine. This is the format:
"WindTurbine: powerOutput = 100 kW bladeSpeed = 80 orientation = horizontal"