Back to DFS's Workshop Page
Back to Agenda Page
Rectangle Problem II
For this problem, you are to cannibalize any available code (such as the solution to the Rectangle Problem I) and write a trio of scripts which will do the following.
- The HTML Page: rect2ask.html
- Ask the user for the dimensions of a rectangle, explaining what will be done with the information
- Accept input in a form
- Using the Calculate button, send the data to a PHP script called rectcalc.php
- The Driver PHP Script: rect2calc.php
- Check the data received to ensure that the values are possible; use die or exit to report problems and terminate execution
- Check the length and the width and swap the values if necessary
- Report the actual length and width
- Call the draw2rect.php script
- Report the perimeter, diagonal and area of the rectangle
- Report the area of the largest circle which will fit inside the rectangle
- The Graphics PHP Script: drawrect2.php
Using different, coordinated, contrastive colors, draw the following:
- A filled rectangle
- The rectangle's perimeter
- The rectangle's diagonal
- The largest possible filled circle inscribed at the left end of the rectangle
To see how this could work, view this possible solution.
© 2005 DFStermole
Created 13 Nov 05
Last Modified 8 Dec 05