TORONTO KIDS COMPUTER CLUB | PMCA Sunday 14:00 Python Homework 21.03.28.
19251
post-template-default,single,single-post,postid-19251,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

PMCA Sunday 14:00 Python Homework 21.03.28.

02 Apr PMCA Sunday 14:00 Python Homework 21.03.28.

Question:
Create an OunceConversion object to convert any number of fluid ounces to the equivalent number of gallons, quarts, pints, and gills. (There are 128 fluid ounces in a gallon. There are 32 fluid ounces in a quart. There are 16 fluid ounces in a pint. There are 4 fluid ounces in a gill.)

  • Get the number of fluid ounces as an integer from the user; make sure to use a descriptive prompt so the user knows what to enter, for example:
    Sample input:

    • Please enter fluid ounces:
  • The object contains methods to calculate the total number of gallons, quarts, pints, and gills represented by the original number of fluid ounces and print it out. for example:
    • convertGallons() – it just simply convert the ounces into gallons then print the result out, the method may have a return value
    • convertQuarts() – it just simply convert the ounces into quarts then print the result out, the method may have a return value
    • convertPints() – it just simply convert the ounces into pints then print the result out, the method may have a return value
    • convertGills() – it just simply convert the ounces into gills then print the result out, the method may have a return value
No Comments

Sorry, the comment form is closed at this time.