Follow the Folding Dot |
Write a program that will keep track of the location of a dot on a piece of paper as it is being folded.
The input file will contain 4 different types of records.
The output will consist of which piece of paper you are working on, the beginning size of the paper, the beginning location of the dot, the size of the paper and the location of the dot when you have finished folding the paper. Format must be as shown in the sample output below.
Place a 5.08.25 paper on the desk in front of you. Place a
dot on the top surface at 3.25 units right of the top left corner
and 8.00 units down from the top. Now, take the top edge of the
paper and fold it over the top. The paper is now 5
4.125
and the dot is on the top of page 2. The location of the new
position of the dot is 3.875 units from the top and 3.25 units to
the right. Use these new `coordinates' as the starting positions
for the next set of folding instructions.
Now, take the left edge of the paper and fold it under the
bottom. The paper is now 2.54.125 and the dot is on the top
of page 2. The location of the new position of the dot is
3.875 units from the top and 0.75 units to the left.
5.0 8.25 3.25 8.00 T TO LU S 1.0 2.0 .55 1.3 B LO S
Paper number 1 Beginning paper dimensions 5.000000 X 8.250000 Dot is on TOP of page 1. Position: 3.250000 X 8.000000 After folding paper. Paper dimensions: 2.500000 X 4.125000 Dot is on TOP of page 2. Position 0.750000 X 3.875000 Paper number 2 Beginning paper dimensions 1.000000 X 2.000000 Dot is on BOTTOM of page 1. Position: 0.550000 X 1.300000 After folding paper. Paper dimensions: 0.500000 X 2.000000 Dot is on BOTTOM of page 2. Position 0.050000 X 1.300000
Other Notes: