22.11.2012 Views

Schaum's Outline Series

Schaum's Outline Series

Schaum's Outline Series

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

162<br />

3. Apayroll program will calculate the weekly gross pay given an input of the<br />

number of hours worked and current wages. Aworker may not work more than<br />

80 hours per week, and the maximum wage is $50.00 per hour. Construct functional<br />

tests.<br />

Functional tests should include tests of normal pay and overtime and tests of the error<br />

conditions.<br />

Hours Wages Expected Output<br />

30 40.00 1200.00<br />

60 50.00 3500.00 (assume overtime)<br />

81 50.00 Invalid hours<br />

20 60.00 Invalid wages<br />

4. Aprogram calculates the area of a triangle. The inputs are three sets of x,y coordinates.<br />

Construct functional tests.<br />

The functional tests should include correct triangles, non-triangles, error conditions,<br />

and the obvious orientation of the triangles.<br />

Point 1 Point 2 Point 3 Expected Area<br />

1,1 1,5 5,1 8<br />

1,1 1,5 1,10 Not a triangle<br />

10,10 0,10 10,0 50<br />

0,0 0,10 10,10 50<br />

0,0 0,0 0,0 0<br />

CHAPTER 10 Software Testing<br />

5. Aprogram accepts two times (in 12-hour format) and outputs the elapsed number of<br />

minutes. Construct functional tests.<br />

The functional tests should include tests of less than 1 hour, more than 1 hour, one<br />

more than 12 hours, one that requires a carry of hours, and one with the times<br />

reversed.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!