### Part 1

Add a random fortune generator to your home page. That is, your page should contain a list of fortunes (stored as an array of strings), and should randomly select one of those fortunes to display each time the page is loaded. The fortune should be displayed just above the page footer, centered and enclosed in a box. For example,

 True wisdom comes not from knowledge, but from understanding.

Hint: to select the fortune from the array of choices, consider using the randomOneOf function from the www.creighton.edu/~davereed/csc551/JavaScript/random.js library.

### Part 2

Create a Web page named grades.html that can be used to compute your grade for CSC 551. The page should prompt the user for quiz, homework, midterm, and final exam grades, and display those grades on the page. It should also compute and display the overall average for the course. Recall from the class syllabus that grades are weighted as follows:

 homework assignments 40 % weekly quizzes 05 % midterm exam 25 % (cumulative) final exam 30 %

When computing the quiz average, be sure to take into account that the lowest quiz grade is dropped. For example, your page might display something like the following:

Homework grades: 95 80 60 100 Quiz grades: 80 100 100 0 90 80 Midterm exam: 80 Final exam: 92 Overall average = 83.75*0.4 + 90*0.05 + 80*0.25 + 92*0.30 = 85.6

Since there will be many homework and quiz grades, having a separate prompt for each grade would be tedious and unwieldy. A nicer approach is to allow the user to enter all homework grades at a single prompt, and all quiz grades at another prompt. To make this possible, you are being given the following function:

 function Arrayify(str) // Assumes: str is a sequence of words, separated by spaces // Returns: an array containing the individual words { var items = new Array(); var count = 0; while (str != "") { var index = 0; while (index < str.length && str.charAt(index) == " ") { index++; } if (index < str.length) { var item = ""; while (index < str.length && str.charAt(index) != " ") { item += str.charAt(index); index++; } items[count] = item count++; } str = str.substring(index+1, str.length); } return items; }

The Arrayify function takes as input a string containing words, each separated by spaces. It returns an array containing each of the individual words as elements. For example, the call Arrayify("80 95 92") would return the array ["80","95","92"]. Using this function, your program can read a sequence of grades into a single string using prompt, and then separate the individual grades into an array for averaging. Note that the array elements are strings, so you will need to parseFloat the array elements in order to average the grades.