TORONTO KIDS COMPUTER CLUB | PMCA Sunday 10:00 Practice -20.
18307

# PMCA Sunday 10:00 Practice -20.

## 16 Sep PMCA Sunday 10:00 Practice -20.

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:
• 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)”