0% found this document useful (0 votes)
4 views1 page

C Program for Cup Conversion Exercise

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

C Program for Cup Conversion Exercise

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Individual, Open offline notes, Graded Exercise.

[No internet access]


Instruction: What you will work on should meet the objectives.

Objectives:

1. To include proper internal documentation (i.e., comments) including an outline of the algorithm.
2. To incorporate coding convention in writing codes, similar to how codes are written in the Modules, slides, and class
discussion.
3. To write syntactically and logically correct C codes, using the printf() and scanf() function calls and assignment
statements.
4. To compile, run, and test the program using the command line interpreter (i.e., gcc -Wall).
5. To determine classes of test values to subject the program with.

Part 1. Write a program that will compute and display the equivalent measurements of the given measurement in cups to the
following: gallon, liter, and ounce. Refer ONLY to the following conversion chart:

1 cup = 8 ounces
1 quart = 32 ounces
1/8 gallon = 1 pint
2 pint = 1 quart
1 liter = 2.1 pint
Assume that the input is non-negative real number. The result should be in 4 decimal places.

*The required program does not need to have functions yet. But, should you wish to use functions, you are allowed to. Note
though that correctness of your implementation is checked, including correctness of user—defined functions, if you chose to
implement them.

Part 2. Create the test script to contain the complete test classes to subject your program to. It is a complete when all tests
result to Pass (P), given your test classes.

Function # Description Sample Input Expected Output Actual Output P/F


Data

main() 1

:::

*Expected output is the result of your manual computation


*Actual output is the result of your program run
*In P/F, P stands for Pass and F stands for Fail. Write P if the expected output is exactly the same as the actual output.
Otherwise, write F.

You might also like