Microsoft Word - JL_BCS350_201_Module3_programming assignment (hw2).docx BCS 350: Web Database Development CRN 24518 JL Spring 2020...

1 answer below »
See the attachment( extra credit included).


Microsoft Word - JL_BCS350_201_Module3_programming assignment (hw2).docx BCS 350: Web Database Development CRN 24518 JL Spring 2020 ------------------------------------------------------------------------------------------------------------------------------ Programming Assignment 2 ------------------------------------------------------------------------------------------------------------------------------ Objectives: To learn to write PHP code to process data passed from HTML form. To learn to write PHP functions and process strings and characters. Tasks: Frequency analysis is the study of the frequency of letters in a text, i.e., the number of occurrences of each letter. In this assignment you will create dynamic web pages to perform frequency analysis to a text document entered by the user. You should create two files: hw2_freq_form.html and hw2_freq_process.php. The file hw2_freq_form.html includes an HTML form with a textarea. It collects a text document entered by the user. After the user submits the form, hw2_freq_process.php processes the data as follows: 1) Display the text document that is entered by the user. 2) Change lowercase letters to uppercase letters using the strtoupper function. 3) Define a function letterCount that accepts a string (text document) and a letter, finds and returns the number of times that the letter occurs in the string. You must write your own function and not use any pre-defined PHP functions except strlen function. Hint: This is the same procedure as searching for an item in an array and finding its number of occurrences. A string is an array of characters. 4) Call the letterCount function to find the number of times each uppercase alphabetic letter (‘A’ to ‘Z’) occurs in the text. If a letter doesn’t occur in the input text, then its count equals 0. 5) Find the total number of alphabetic letters in the input text. Special characters and punctuations are not counted. 6) Calculate the letter frequency by dividing each letter count by the total number of letters. The letter frequency is the percentage ratio of the number of times a letter occurs in the text to the total number of alphabetic letters in the text. 7) Display the frequency analysis results in an HTML table in alphabetic order, i.e. display 26 alphabetic letters, the letter count and letter frequency for each letter. Keep 2 decimal places for letter frequency. Make a fieldset and place “BCS350 Assignment 2 - your name” on the top of both web pages. Don’t put your name in the title of your page. You are free to decide the styles of your pages. Be sure to add comments so readers can understand your code. Extra Credit: Sort the frequency analysis results in descending order of letter frequency and display the results in a new table. Hints: 1. For the extra credit part, use the array_combine function to create an associative array by using the alphabet array for keys and frequency array for values. Then use one of the sort functions we learned in class to sort the new array as required. 2. If you need help on HTML textarea form and HTML tables, please refer to http://www.w3schools.com/tags/tag_textarea.asp http://www.w3schools.com/html/html_tables.asp. Submission: You should submit a ZIP file that includes two files named hw2_freq_form.html and hw2_freq_process.php on Blackboard by the due date. Do NOT use any other file names. Please include the integrity statement “I certify that this submission is my own original work” with your name and RAM ID as comments in all your source files. Sample Output: 1. hw2_form.html page launched 2. Results of hw2_freq_process.php (partial): …
Answered Same DayFeb 20, 2021BCS350

Answer To: Microsoft Word - JL_BCS350_201_Module3_programming assignment (hw2).docx BCS 350: Web Database...

Arun Shankar answered on Feb 21 2021
161 Votes
Inputs
    
        
        Enter your text here :
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here