TORONTO KIDS COMPUTER CLUB | Tuesday Thursday 15:00 Python Practice 20.08.29.
18227
post-template-default,single,single-post,postid-18227,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

# Tuesday Thursday 15:00 Python Practice 20.08.29.

## 01 Sep Tuesday Thursday 15:00 Python Practice 20.08.29.

Question：

Create an FluidConversion object to convert any number of fluid units 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 gallons, quarts, pints, gills and ounces as 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 gallons:
Please enter fluid quarts:
Please enter fluid pints:
Please enter fluid gills:
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(gallons, quarts, pints, gills, ounces)    – it just simply convert into gallons, the method will have a return value
• convertQuarts(gallons, quarts, pints, gills, ounces)    – it just simply convert into quarts, the method will have a return value
• convertPints(gallons, quarts, pints, gills, ounces)    – it just simply convert into pints, the method will have a return value
• convertGills(gallons, quarts, pints, gills, ounces)    – it just simply convert into gills, the method will have a return value
• convertOunces(gallons, quarts, pints, gills, ounces)    – it just simply convert into the ounces, the method will have a return value
• convert()   –  convert any number of fluid units to the equivalent number of gallons, quarts, pints, and gills. for example:
• “1 Gallon 6523 fluid ounces is 51 gallon(s)+3 quart(s)+1 pint(s)+2 gill(s)+3 ounce(s)”
• Define __str__(self)  show calculated number of gallons, quarts, pints, gills and ounce in one line, for example:
• “6523 fluid ounces is 50 gallon(s)+3 quart(s)+1 pint(s)+2 gill(s)+3 ounce(s)”
##### No Comments

Sorry, the comment form is closed at this time.