Your instructor will assign you one of the problems below. To
solve your problem, write a program that reads the necessary
information to compute and output the indicated values, as
efficiently as possible. Following the pattern in the lab
exercise, first, *design* using OCD; then *code* your
design in C++ using stepwise translation; finally, test your
program thoroughly.

Project #8.1: White water rapids are classified by theirgradient(the number of feet per mile they descend) and theirclass(a difficulty rating in the range 1-6, with 1 beingcalmand 6 beingunnavigable.) Popular white water rafting trips in Pennsylvania and West Virginia include the lower Youghiogheny (gradient 15, class 3), the New (gradient 25, class 4), the Cheat (gradient 35, class 4), and the Upper Youghiogheny (gradient 125, class 5).Write a menu-drive program that displays a menu of the trips, and displays the gradient and class of whatever trip the user selects. Your program should include a function that, given the trip selected by the user, passes back the gradient and class of that trip.

Project #8.2: Write a function`Sort3()`

that, given three integer arguments,`int1`

, and`int2`

, changes the values of those arguments so that their values are in ascending order (i.e.,`int3`

<=`int1`

<=`int2`

---looks like a postcondition!). Write a driver program that demonstrates the correctness of`int3`

`Sort3()`

.

Project #8.3: Your local painting supplies store would like a paint-mixing "expert system." Write a function that, given a non-primary color (i.e., orange, green, purple) will pass back the two primary colors that must be mixed to produce that color (i.e., red and yellow must be mixed to produce orange, yellow and blue to produce green, and blue and red to produce purple). Use a`string`

object to store a color. Then write a menu-driven program that allows its user to enter, process and display the solution of as many paint-mixing problems as the user wishes.

Project #8.4: A quadratic equation is an equation of the formaxWrite a function that, given the^{2}+ bx + c = 0`a`

,`b`

and`c`

values defining a quadratic, passes back the two roots of that quadratic. To compute the roots, use the quadratic formula:-b ± sqrt(bYour function should check for common errors, such as^{2}- 4ac) roots = -------------------------- 2a`a == 0`

and`b`

being negative.^{2}- 4acCreate a user-friendly driver program that allows its user to compute the roots of an arbitrary number of quadratic equations.

Turn the following things:

- This grade sheet.
- Your OCD.
- Your source program.
- The output from an execution of your program.

Lab Home Page | Lab Exercise

© 2003 by Prentice Hall. All rights reserved.

Report all errors to Jeremy D. Frens.