



|
|
P Dunn's Super CS1 Site
|
Programming Challenge Archive
Shapes World Programming Challenge
Thinking
|
|
Text File --
Thinking
Thinking for program challenge 2 programs
Problem 1 - Money
In this problem three coins, a quarter, nickel and a dime +
are placed on a dollar bill so they don't overlap nor touc+
h the edge of the dollar bill.
To solve this problem we will use goal-driven method.
1)The main goal - to find the area of the dollar bill that+
is not obscured.
2)The sub-goals-
a)To find the dimensions of the dollar bill and compute +
the area of it.
length = 184.15 mm
width = 91.44 mm
b)To find the dimensions of the coins involved and compu+
te the area of each of them.
diameter of the quarter = 24.26 mm
diameter of the nickel = 21.21 mm
diameter of the dime = 17.91 mm
c)Each monetary piece will have to be created as an obje+
ct.
3)Now solve the goal
a)Add up the area of the coins and subtract that from th+
e area of the dollar bill and we'll have our answer!
Problem 2 - AlienChessman
In this problem we have an alien chessman descend on the b+
oard he moves all over the place in straight lines. We ne+
ed to figure out how far he travels in his "tour" on the c+
hessboard.
We'll use imaginative construction and create a bunch of r+
ectangles and a triangle or two to do some computations. +
However:
1)First we are given that one side of the board, the wid+
th, is 19.6 inches.
2)Since this a congruent square chessboard we will assum+
e that the length of the chessboard is also 19.6 inches.
3)Now we will create a square which will comprise of the+
chessboard.
4)Once we have the chessboard created we will find out t+
he area and divide that by 64 which will give us the squar+
e inches of each space.
5)Now for the first move from A1 to E4:
a)We will construct a rectangle of 5 squares length an+
d 4 squares width.
b)Then we will obtain the diagonal length of that rect+
angle, this will cover the space traveled in that space an+
d store it.
6)Second move - E4 to G3
a)Construct a rectangle of 3 squares length and 1 squa+
re width.
b)Obtain the diagonal and store it. This will be adde+
d to the result in 5b.
7)Third move - G3 to H8
a)Construct a rectangle of 1 square length and 5 squar+
e height.
b)Obtain the diagonal and store. This will be added t+
o the result in 6b.
8)Fourth move - H8 to B5
a)Construct a rectangle of 7 square length and 4 squar+
e height.
b)Obtain the diagonal and store. This will be added t+
o the result in 7b.
9)Fifth move - B5 to A1
a)Construct a rectangle of 1 square length and 4 squar+
e height.
b)Obtain the diagonal and store. This will be added t+
o the result in 8b.
10)Add up the results in b) and display, this will be tot+
al length traveled.
3) Room - get the distance from the corner of one room two+
the other. We'll use imaginative construction and explode+
the squares from the cube of the room.
To Solve:
1) Create a rectangle of 8 x 14.
2) Get the area of the front rectangle and achieve the d+
iagonal.
3) Create a rectangle of 14 x 11.
3) Get the area of the top rectangle and achieve the dia+
gonal.
3) Add the diagonals together we'll have our area.
|
|
|