SE2840 Midterm Exam
You may use a single double-sided sheet of notes, that you must sign and hand in with your exam.

You may access any online resources to help you complete the exam.

The exam will cover all material in the course through the end of week 4 (and lab 4).
The exam will consist of two parts: Part 1 will be a Blackboard quiz with short-answer/multiple-choice problems. Part 2 will be a small coding problem that you will also submit via Blackboard, as you do for lab assignments.

Focus areas:

  1. HTML elements and syntax for creating web page content
  2. CSS syntax, selection, and rules for modifying the basic appearance of elements on a page
  3. Applying Bootstrap classes for standard styling to tables, buttons, and text
  4. Javascript selection, jQuery selection of elements on a web page
  5. Validation of input for errors (as in past labs)
  6. HTML element event handling with Javascript and jQuery
  7. Dynamic DOM modification using Javascript and jQuery
  8. Simple effects using jQuery (show/hide/fade)
  9. Write Javascript classes and methods using current best practices.

 

 

Practice:

Write the JavaScript class Dog whose constructor takes two string parameters representing the name and color of the Dog.

The constructor should set the Dog's name and color properties to these arguments' values. 

The class contains two additional methods: 

1) a "public" method  getName that returns  the name of the Dog

2) a "private" method setColor that takes a single string parameter and sets the Dog's color according to the parameter.

 

 

Practice:

Consider the following declaration:

let forecast1 = [

{    "city": "Milwaukee",    "state": "WI",    "date": {"day":"16", "month":"Jan", "year":"2020" }, 
    "today":{        "temperature": "22",       "humidity": "36%",       "wind-Speed": "1"     },
    "tonight":{        "temperature": "-2",       "humidity": "10%",       "wind-Speed": "3"     },
    "tomorrow":{        "temperature": "15",       "humidity": "10%",       "wind-Speed": "2"     }
},

 {    "city": "Madison",    "state": "WI",    "date": {"day":"16", "month":"Jan", "year":"2020" }, 
    "today":{        "temperature": "19",       "humidity": "33%",       "wind-Speed": "0"     },
    "tomorrow":{        "temperature": "4",       "humidity": "14%",       "wind-Speed": "5"     }
}

] ;

Write the Javascript statement that declares a variable x and assigns it to the temperature in Milwaukee today. What is the datatype of x?

Now assign x to the wind speed in Milwaukee today. (Hint: special syntax required!)

What happens when you try to assign x to the temperature in Madison tonight?  How can you check for this condition?

 

 

let forecast2 = {weather:[

{    "city": "Milwaukee",    "state": "WI",    "date": {"day":"16", "month":"Jan", "year":"2020" }, 
    "today":{        "temperature": "22",       "humidity": "36%",       "wind-Speed": "1"     },
    "tonight":{        "temperature": "-2",       "humidity": "10%",       "wind-Speed": "3"     },
    "tomorrow":{        "temperature": "15",       "humidity": "10%",       "wind-Speed": "2"     }
},

 {    "city": "Madison",    "state": "WI",    "date": {"day":"16", "month":"Jan", "year":"2020" }, 
    "today":{        "temperature": "19",       "humidity": "33%",       "wind-Speed": "0"     },
    "tomorrow":{        "temperature": "4",       "humidity": "14%",       "wind-Speed": "5"     }
}

] };

Does it matter whether (no pun intended) "weather" is quoted or not?

Write the Javascript statement that deslares a variable x and assigns it to the wind Speed in Madison tomorrow.

 

let strForecast =`[{"city": "Milwaukee","state": "WI","date": {"day":"16", "month":"Jan", "year":"2020" },"today":{"temperature": "22","humidity": "36%","wind-Speed": "1"},"tonight":{"temperature": "-2","humidity": "10%","wind-Speed": "3"}, "tomorrow":{"temperature": "15","humidity": "10%","wind-Speed": "2"}}]`;

 

This is a valid JSON String - how can you convert it to a JavaScript object???

What is the main syntactic difference between a JSON string declaration and a JavaScript object declaration.