PHP Basics Assignment The purpose of this assignment is to give you some hands-on experience with basic PHP syntax. It is broken up into two segments.
Section 1 - Print the following poem exactly as displayed: 'Twas brillig and the slithy toves Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe. "Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bander$natch!" The poem is a segment from Lewis Carol's Jabberwock. Both stanzas (paragraphs) are to be printed entirely within PHP print statements. The first stanza requires one print(''); and the second, one print(""); notice the distinction between the types of quotes required for both print statements. Be sure to use one print statement per stanza. No mixing of quotes; the print('') can not contain a double quote "; print("") can not contain a single quote '. The first stanza requires a variable substitution for the word brillig. Assign a variable this string value and substitute it into its appropriate location within the corresponding print statement. You're looking at the printed lines from the PHP program, more specifically unrendered HTML. It's important to make this distinction as you format the output using special types of characters.
Section 2 - Distance is equal to velocity multiplied by time. (We'll assume that velocity is scalar - instead of velocity, we'll just call it speed) In other words, how far one travels is determined by the speed times time. The basic unit for speed is miles per hour (mi/h), time hours (h), and distance miles (mi); store these unit values as variables. Determine what distance 'John' has traveled going 50 mi/h over a span of 2 hours. Second, determine how much time has transpired when 'John' has traveled a distance of 70 mi at a rate of 55 mi/h. Print out the results along with their appropriate units (i.e. Speed = 33 mi/h). The output for the calculations should look exactly like: John traveled _mi when traveling at a rate of _mi/h over
a period of _h. The units should be italicized and the blanks should be filled in with their corresponding values. Use double quotes " for the print statement(s) for this section. You don't see HTML tags here because you're replicating the result of rendered HTML. Don't duplicate the source code on this page for the above passage; you'll notice that it doesn't quite satisfy the specifications.
Specs
Notes
Turning it in |