The people of Bumpus (Bumpkins) are a fun, happy, peace-loving people who have a big problem. They have very little depth perception and are constantly running into doors. They’ve asked you to write a program to let them know when they should duck going through a doorway. Since Bumpkins love fun, some of their doorways have been made intentionally short of force other Bumpkins to either crawl or limbo through the door. Unfortunately, the Bumpkins don’t all use the same set of measurements, so some heights are measured in inches, others in feet, others in yards, others in centimeters, and others in meters. To do the conversions, recall that:
1 inch = 2.52 cm
1 yard = 3 ft
1 foot = 12 inches
The input file will begin with a single line, telling you how many Bumpkins want help. Then, for each Bumpkin, there will be data about the Bumpkin and the doorways they reach. The first line of each dataset will give you the Bumpkin’s name (all Bumpkins have names of exactly 6 characters), an integer n, the number of doors to process for this Bumpkin (n > 0), and the Bumpkin’s height, a floating point number followed by exactly one blank and then one of ‘i’, ‘f’, ‘y’, ‘c’, or ‘m’ (representing inches, feet, yards, centimeters, and meters). The next n lines will have the height of the doorways in the bumpkin’s life, one per line. Each height will be a floating point number followed by exactly one blank and one of ‘i’, ‘f’, ‘y’, ‘c’, or ‘m’ (representing inches, feet, yards, cm, and meters). Use of an input file is a requirement.
For each bumpkin, print the name of the Bumpkin on one line and then for each door, print the way the Bumpkin should travel through the door. Decide on a mode of travel based on the table below, where b is the height of the Bumpkin, d is the height of the door (expressed in the same units):
Door Height Travel Method
d > b * 1.25 Stilts
b * 1.25 >= d > b *1.05 Walk
b * 1.05 >= d > b * 0.65 Duck
b * 0.65 >= d > b * 0.40 Crawl
b * 0.40 >= d > b * 0.25 Limbo
b * 0.25 >= d Blocked
Have one blank line after each data set. You may have your program create an output file with results formatted as above. Bonus points if you do both.
The following are sample inputs and outputs. Note that the sample input is from the keyboard and uses appropriate prompting. You will need to look above to recall what the input values represent. Use an input file called bumpkin.in that would contain all of the lines of input and an output file named bumpkin.out. See below for sample file I/O. Reminder! Use of the input file is a requirement. Output may be either on the screen or in a file created by the program, or both.
Sample Interaction (prompts are in bold, program results in italics, plain text is input)
Please enter the number of bumpkins to process:
2
Please enter bumpkin #1's name, no. of doors, height, and units (seperated by spaces):
Mookin 3 150.4 c
Mookin
Please enter door #1's height and units (seperated by spaces):
75 i
Doorway 1: Stilts
Please enter door #2's height and units (seperated by spaces):
2 f
Doorway 2: Crawl
Please enter door #3's height and units (seperated by spaces):
151 c
Doorway 3: Duck
Please enter bumpkin #2's name, no. of doors, height, and units (seperated by spaces):
Kimkin 1 67.3 i
Kimkin
Please enter door #1's height and units (separated by spaces):
204.5 c
Doorway 1: Walk
SAMPLE: File Input (contents of the bumpkins.in)
2
Mookin 3 150.4 c
75 i
2 f
151 c
Kimkin 1 67.3 i
204.5 c
SAMPLE: File Output corresponding to the Sample Input
Mookin
Doorway 1: Stilts
Doorway 2: Crawl
Doorway 3: Duck
Kimkin
Doorway 1: Walk