60 likes | 193 Views
HW 4 Strings. INFSCI 1059. HW 4 Strings. HW4 Part 1: When you click on the following link http:// www.sis.pitt.edu/~ perkoski/is1092/Homework/answers/HW4/Strings/bobWebPage.php you will attempt to run bobWebPage.php but as you can see it fails. Here is the link to bobWebPage.txt:
E N D
HW 4 Strings INFSCI 1059
HW 4 Strings • HW4 Part 1: • When you click on the following link http://www.sis.pitt.edu/~perkoski/is1092/Homework/answers/HW4/Strings/bobWebPage.php you will attempt to run bobWebPage.php but as you can see it fails. Here is the link to bobWebPage.txt: • http://www.alladinacademy.com/is1059/Homework/HW4/bobWebPage.txt • which displays the code. • Correct the code by “fixing” the string so *your* version of bobWebPage.php runs and displays my homepage. It should look like this when you run your php file: http://www.sis.pitt.edu/~perkoski/ • Now, do not view source from the immediately previous link and cut and paste - it will not work properly due to relative path links to images. Work with the string in bobWebPage.txt • Post your own bobWebPage.php and bobWebPage.txt files.
HW4 Strings • HW4 Part 2 • After fixing the string in bobWebPage.php create a new file called bobWebPage2.php and copy all of your code into it. Delete your echo statement. • Each section below must be implemented in FUNCTIONS!!! • If you can’t get something to work – simply echo in your function something like “Unable to complete” and comment out the bad code – DON’T STOP YOUR PROGRAM • Write a function that searches for any occurrences of “INFSCI” and changes them to “Information Science” • Write a function that extracts the Cascading Style Sheet starting with <style> and ending with </style> • Display the style sheet – not just use view source to see it. • Post your bobWebPage2.php and bobWebPage2.txt
HW4 Strings • HW4 Part 3 • Click on the link http://www.alladinacademy.com/is1059/Homework/HW4/baseball.txt • There you will find a long string named $baseballString. This is what you will use in the next assignments. • Create a php file called baseball.php • Add the long $baseballString to your file • Write the following functions:
HW 4 Strings • Write a function that prints out the number of words. Output: The number of words in $baseballString is ANSWER. • Write a function that prints out the last 119 characters of the string. Output: The last 119 chars of $baseballString are ANSWER. • Write a function that displays the character position of the substring .393 • Write a function that displays the character position of the substring .00728
HW4 Strings • Write a function that prints out on a separate line each team and their stats. Start each line with the name of the team. • Post your baseball.php and baseball.txt files