CPE 101
Project #2

Objectives

Resources

Ground Rules


1.0 Overview

Ski Wax Selection

The Wicks Corporation manufactures a line of 14 different waxes for cross-country skiing. Because many of their customers have a difficult time selecting the proper wax to use, the company has decided to sell a hand-held computer to aid in the selection. You have been hired to write the program for this computer. Wax choice depends on temperature and snow conditions. The waxes come in various degrees of hardness that are devided into six color groups. A skier selects a wax color on the basis of temperature. All of the color groups except Yellow and White have three varieties (Special, Standard, and Extra) to account for variations in snow conditions (Powder, Firm, and Crusty). The two waxes for the highest and lowest temperature extremes (Yellow and White) come only in Standard. Your program should accept as input the current temperature and snow condition. Then compute and print out the most appropriate wax.  The temperature and snow condition guidelines are shown below.

Temperature Guidelines (used to select a wax group)
 

Wax Group         Temperature

Yellow         38 < Temp

Red            31 < Temp <= 38

Violet         26 < Temp <= 31

Blue           18 < Temp <= 26

Green           5 < Temp <= 18

White               Temp <= 5


 

Snow Condition Guidelines (used to select a variety for waxes other than the extreme - temperature waxes (Yellow and White).
 

Wax Variety         Snow Conditions

Special                    Powder

Standard                 Firm

Extra                      Crusty


      2.0 Inputs Temperature, the current temperature, an integer.
Valid range: -50 < Temperature < 100

Snow, the current snow condition, a character.
'P' for powder, 'F' for firm, 'C' for crusty


3.0 Outputs

A prompt for temperature, and a prompt for snow condition.
The wax variety.
The wax color.
An error message if the input data is invalid.


4.0 Functions

Display prompt for input data.

Read the temperature and snow condition.

Determine wax color (given the temperature) using the temperature guidelines table above.

Determine was variety (given the snow conditions) using the snow conditions guidelines table above.

Print the wax variety and the wax color.

Print "Invalid input" if either the temperature or snow conditions are invalid.

6.0 Sample Execution:

Enter the current temperature: 35

Enter the snow conditions (P=powder, F=firm, C=Crusty): P

The best wax is: Special Red

7.0 Constraints

You must write implementations for the functions defined in this header file:   skiwax_lib.h

Write your implementations in a separate source file named: skiwax_lib.c
Do not include a main function in this file. Compile this file separately without linking it (as you learned in the lab activities).
Write unit tests in a separate source file named: skiwax_tests.c   
Compile this file separately without linking it.
Link both the object files (.o) together into an executable (a.out):   gcc skiwax_lib.o skiwax_tester.o


Write your main function in a separate source file named: skiwax.c
Compile this file separately without linking it.
Link both the object files (.o) together into an executable (a.out):   gcc skiwax_lib.o skiwax.o

8.0 Testing

The instructor has provided a test driver that you may use to verify your functions are working correctly before you write the main program.  It is an object file compiled for unix1 located at:  ~graderjd/Public/skiwax_tester.o

You should test your program with enough input data to demonstrate minimum complete coverage.  That is, your test data must cause every statement in the program to be executed, and produce correct results.

9.0 Grading

15% find_wax_color()  passed minimum complete coverage test
15% find_wax_variety() passed minimum complete coverage test
15% is_valid_data() passed minimum complete coverage test
5%
is_valid_data() passed boundary value test.
5% find_wax_color() passed boundary value test
15%
main driver passed integration test
10% Algorithm design uses structured logic for decisions.
15% Coding style.
5% Clean compile (no warnings using the required compiler flags).

Remember, your program will be tested on unix1.  Code that does not compile will receive a grade of zero.

10.0 Submitting Your Work

You need to submit your source code electronically using the   handin   utility:

  1. You will submit three source code files, named as follows:
      skiwax_lib.c contains the implementation of the functions defined in skiwax_lib.h.
      skiwax_tests.c contains the unit tests (using checkit).
      skiwax.c    contains the main program.
     
  2. Move the necessary file(s) to your unix1 account using your favorite secure file transfer program.
  3. Log on to unix1 using your favorite Secure Shell client program.
  4. Change directory (cd) to the directory containing your source file to hand in.  
  5. Be sure to compile and test your code on hornet using the required compiler flags ( -Wall –ansi – pedantic) one last time just before turning the files in.
  6. Submit your code using handin:
    handin graderjd Project2 skiwax_lib.c skiwax_tests.c skiwax.c

  7. You should see messages that indicate handin occurred without error. You can (and should) always verify what has been handed in by executing the following command:
    handin graderjd Project2
  8. Late submissions receive no credit.