Topical Information

This program will help you develop a useful application from input, output, calculations (including modulo), and data types. It is also a good place to start using constants.

Program Information

Write a program that helps the user convert information given in (whole) ounces into pounds and ounces.

To refresh your memory, there are 16 ounces (which is always abbreviated oz.) in a pound (which is abbreviated lb. singularly or lbs. in the plural).

Be sure to report the results neatly.


As an example, you might have the program interaction look something like (the parts in this color are typed by the user):

$ ./ounces.out

                 Welcome to the Ounce Conversion Program!!!

How many ounces do you have?  62

Thank you!!  Calculating...  Done.

62 oz. is equivalent to 3 lbs. and 14 oz. (3.875 lbs.).

Thank you for using the OCP!!

Endeavor to have a magnanimous day!

$

Thought Provoking Questions

  1. What value is the constant in this program? What [data] type of value is it? What does it stand for? What did you name it? (Note: All of these questions imply there IS a constant ...and only ONE constant!!!)
  2. What variables do you have in this program? What are their data types?
  3. How can you get both the decimal total pounds and the whole pounds with remaining ounces from the same input value?
  4. What happens if the user types a fractional number of ounces to begin with? (I.E. 4.2?) (Do not try to correct this behavior — just document it.)
  5. What happens if the user accidentally types a symbol or letter instead of their ounces amount? (Again, do not try to correct this behavior — just document it.)

This assignment is (Level 2).


Options


Total Level Possible

If you did all above options, this lab could be worth as much as (Level 5).