|
home—lects—exams—hws
D2L—breeze (snow day)
We shall start developing a file of useful utility functions for php.
We'll have two files, named something like util.php and util-test.php.
The second file will just
(20pts) Write a function which takes in (a) an array of strings (checkbox-descriptions) and (b) a group-name, and returns a string that happens to be valid html for a series of checkboxes. (The string should include newlines, and (if you want) each line might start with 6 spaces, to serve as indentation.)
For example, the
Include at least two test cases;
you'll probably want to write a sample series of checkboxes by hand,
to serve as your expected-output.
Use a label tag, to group the checkbox with its adjacent text.
(10pts)
Write a function
Since this is a void function (it only prints), testing is problematic, and so we won't have any unit tests for it. (So be extra-sure to test it carefully by hand.)
(Very similar to the lecture notes:)
Write a function
(5pts)
You can test this be assigning to
(5pts)
Write a function
Note that fully half the points are awarded for having good tests (when possible), a good signature (function and parameter names), and a short description of the arguments/types (one sentence usually suffices). In addition to correctness, code quality and readability count.
You are working for Lizard Entertainment, makers of the popular adventure game, .World of Wowcraft (“.W.o.W.”). In .W.o.W., players choose a type of character: either warrior, mage, priest, or rogue. Over the course of the game, their characters can learn various skills, depending on type: For example, the diplomacy skill (which is learnable only by rogues and priests), or the acrobatics skill (which is learnable only by rogues and warriors), etc.. Each skill is be tied to one of six built-in character traits: Strength, Intelligence, Wisdom, Dexterity, Constitution, and Charisma. Finally, each skill has a minimum-level (between 30 and 100 inclusive).
Your boss decides that a key feature of the game is that people can add their own skills to the game. Your job is to build a web-page that lets people enter new skills for the game to use. People will enter the name of the skill, a detailed description, which character-types can use it, what trait it's tied to, and their own name (to get the glory). When they submit their form, they will see a response page summarizing the information they entered.
An example of filling out the form | The result of the processing the form |
(30pts) Build two PHP pages: the form, and a page to handle the form and display the results.
Your pages don't need to look identical to the above images3, but should look well-organized, typo-free, etc. When I grade, it will be from the mindset of a small-company owner who has hired you to create my web-site. … A grumpy, perfectionist small-company owner.
Call your functions from Part I appropriately.
You do not (yet) need to validate any data (including the minimum level being between 30 and 100); we'll add that over the next few assignments. However, do make sure that any special characters like < or & are handled correctly (that is, the displayed description shows those characters, without any markup), and that newlines are preserved.
(10pts) Define a css class “important” that centers its text and puts a green border around the item; use this for the page's title (which might be in an h1 tag). Similarly, define a css class “additional-info” that has font-size: smaller and font-style: italic. Use this for both the page's signature at the bottom, and reminder information about the restriction on min-level.
(10pts)
Finally, have a file index.php which
starts with a link to your form (for part II),
and a link to this hoemwork.
Then, follow that with
calling
Important note: I will grade your homework by visiting https://php.radford.edu/~yourUserId/itec325/hw02/, and going from there. If I cannot locate/view your file, there will be a minimum 15% penalty. Please double-check your own page via the web, reasonably soon after the due-date.
If you need to modify your files after the due-date:
Please run/check your program/html incrementally — don't write huge amounts of the assignment w/o even running it.
1I personally recommend using the Oxford comma, but will leave it to your preference. ↩
2
I'm not sure: you might be able to use
3But please, don't have your pages include instructions to email me. ↩
4the function to show-source a file is one of the few exceptions ↩
home—lects—exams—hws
D2L—breeze (snow day)
©2012, Ian Barland, Radford University Last modified 2012.Sep.22 (Sat) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |