Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CS213 Final Exam Fall 2022

Problem 1: Convert Fahrenheit to Kelvin

•   Create a JavaScript function called displayDegK that takes the user’s input for the name of a location for their lab, and temperature in degrees Fahrenheit and calculates and          displays the location of the lab and the temperature in Kelvin.

•   Hint: Use the formula on this web page.

•   NOTE: You cannot have temperature in Kelvin thats negative (i.e. less than OoK).

•   Add the function code between the comments where indicated!

•   Display all calculated answers in two decimal places using the toFixed() method.

•   Modify the h1 tag!

Problem 2: CSS

•   Using internal CSS styles ONLY:

o Change the color of the list item text to green.

o Change the font size of the text in the list items to xx-large.

o Set the background color of the tag with the poem title and author to magenta.

•   Create a class called newborder that makes a dashed border, 3 pixels wide, and red.

•   Apply the newborder class to the element containing the poem and to the image.

•   Center the poem title and author text.

•   Change the font size of the first line of the poem to x-large.

•   Change the font, font weight, color, and background color of the first letter of the poem.

•   Change the color of the second paragraph to a legible shade of red using a hexadecimal color.

•   Change the background color of the line with the Source:’ to cornflower blue using a color name

•   Do not modify any inline or external CSS styles provided.

•   Modify the h1 tag when done!

Problem 3: Create a Sentence

•   Create a JavaScript function called randSentence that grammatically selects a word from each of four categories below:

o Article: "The", "A", "This"

o Nouns: "season", "car", "cat", "house";

o Verbs: "was", "is", "goes", "feels", "looks"

o Adjectives: "cool", "grand", "mild", "awesome", "cute", "fast" .

Hint: you need to create four arrays, one for each category

•   Combine the four random words to create a grammatically correct sentence (Article Noun Verb Adjective.).

•   NOTE: Most sentences generated will be syntactically incorrect, but some will be both grammatically and syntactically correct.

•   Add the function code between the comments where indicated!

•   Modify the h1 tag!

Problem 4: Conditions and Some Math

•   Write a function named calculateGrade that:

o takes 1 argument, a traditional letter grade, either "A", “A- “, "B+", "B", "B-" as follows:

A is calculated as 4.00 (a number grade to two decimal places)

A- is calculated as 3.67

B+ is calculated as 3.33

B is calculated as 3.00

D+ is calculated as 1.33

D is calculated as 1.00

D- is calculated as 0.67

F is calculated a 0.00

•   You need to include the grades in the ellipsis “…” above too, i.e. B-, C+, C, and C-.

•   Call that function for a few different scores and show the result to make sure it works.

•   Add the function code between the comments where indicated!

•   Modify the h1 tag!

Problem 5: Geometry

•   Using JavaScript, create a function called doSphere that runs when the user clicks the button. The function should:

o Get the user input of the radius of a sphere.

o Calculate the Volume, and Surface Area of the sphere.

o Display the results in the given boxes when the user clicks the Calculate the Results! button.

o Use the ids and button provided for you.

o Display all answers in three decimal places using the toFixed() method.

•   Add the function code between the comments where indicated!

•   Modify the h1 tag!

Problem 6: Image Map

•   Create an image map using the bentley.jpg image with the following hotspots:

•   A circle on the Bentley Library at coordinates (350,115) and radius 60px. The alternative text

is Library. When someone clicks on the hotspot they will be taken to

http://library.bentley.edu.

•   A rectangle on the Smith Technology Center with the coordinates of the top left corner at   (120,120) and rectangle is 80px wide and 40px high. The alternative text is CIS Department. When someone clicks on the hotspot they will be taken to

https://www.bentley.edu/academics/departments/computer-information-systems.

•   Add the code between the comments where indicated!

•   Modify the h1 tag!

Problem 7: Dice

•   Use the array called diceFace.

•   Create a function called computerRollsDice() that when the user double clicks the Computer’s Dice image once, it randomly rolls the dice to display one of the six faces as the new Computer’s Dice image.

•   Create another function called youRollDice()that when the user clicks the Your Dice image, it randomly rolls the dice to display one of the six faces as the new Your Dice       image.

•   Add the function code between the comments where indicated!

•   Modify the h1 tag!

Problem 8: JavaScript to Change CSS

•   Using JavaScript DOM styles, create a changeSummerSun function that runs when the “Click Me!” button is clicked. The function should change the following things about the Mark Twain poem:

o Change the color of the last two lines to red

o Change the color of the first two lines to orange

o Change the font of the title to Palatino Linotype

o Add a 3px purple border to the third line

o Replace the word by” in the title with written by”

o Change the alignment of the fourth line to the right

o Add a green shadow to the remaining two lines.

•   Modify the h1 tag!