The following guidelines are expected for all homework submissions:

- All homework must be typed. Homework which is not typed will be returned ungraded and will be subject to the late homework guidelines as set out on the syllabus page. PLEASE DO NOT scribble something on lined paper and rip it out of your spiral notebook — hanging chads went out with the presidential election in 2000.
- I don't care too much about what font you use or how large your margins are; however, you might want to check out a monospaced font for typing code, as it will be easy to see the indentations.
- Speaking of indenting, PLEASE DON'T USE TABS TO INDENT YOUR CODE. Tabs can often get interpreted differently by different computers and applications, and could make code that is nicely formatted on your computer look "all over the map" on my computer or printer. USE SPACES INSTEAD. You can set up almost every modern text editor to insert spaces whenever you press the TAB key, or you can simply pound the spacebar.
- Work with a partner. This mimics an industry code development model called "pair programming" which is part of the Extreme Programming software development method. Feel free to collaborate in your pairs as much as you want, preferably doing the entire assignment together.
- DO NOT share your work between groups. Doing so will count as plagiarism. If you wish to discuss solutions with another group over coffee in the Lair, that's fine as long as it is kept at the conceptual level, but each group needs to turn in its own version of the solutions.
- You only need to turn in one copy per group.
- If you'd like to use the jsfiddle website to do your programs, that is great. Simply save the program in jsfiddle as a shared fiddle, then copy and embed a link to the fiddle into your homework where the answer goes for that problem. I'll use the link to go to YOUR fiddle and run the code. To save your fiddles you'll need to sign up for an account…

`p = { x: 1, y: [ 4, {z: 2} ] }`

. What is `p.y[1]`

?{call: "mark", next: {call: "ready", next: {call: "set", next: {call: "go", next: null}}}}

9 | 8 | 2 | -5 |

π | 7 | 2.8 | 6 |

-22 | 4 | 0 | 100 |

Matrices can be represented in JavaScript as arrays of arrays. Write a JavaScript array expression for the preceding matrix. Your array should have three elements, each of which is an array of four elements.

var p1 = {name: "Alice"}; var p2 = {name: "Bob", manager: p1}; p1.manager = p1;

`p2.manager.manager.manager.name`

in the previous question?`prompt`

, without assigning the result to
a variable, is useless. Would you agree or disagree? Explain your answer using the following
script (simulating a person who speaks but does not listen) for support:
prompt( "Hi, how are you today?" ); alert( "Gee, that's great!" );

all the time. Knowing that she is the kind of kid who loves technical, precise explanations of linguistic features, what do you tell her? (delete player.winnings;

- If a number in the sequence,
*n*, is even, then the next number in the sequence is n / 2 - If a number in the sequence,
*n*, is odd, then the next number in the sequence is 3n + 1

`10 → 5 → 16 → 8 → 4 → 2 → 1`

involves six steps.
If the initial value is 1, then you should report zero steps.`split`

the input string, producing an array that is then processed
by the acronym-generating code from this chapter.Exercise 1: Create a web page which has many parts and looks really "busy". You can have headers of all different sizes, paragraphs of text, tables with multiple columns and rows, images, ordered/unordered lists, and any other HTML parts that you would like to put on the page. Include a button that will create a listing of all the elements by type and display it to the footer area of the page. Write the JavaScript in a separate file

Exercise 2: Create a web page and matching JavaScript file that will implement a simple four-function calculator. There must be a text box for entering numbers, and buttons for add, subtract, multiply, and divide. You should also have a button for "equals" like a normal calculator. You don't have to make the calculator do anything fancy like maintaining running subtotals or trigonometric functions (you can if you want!) but try to make the page function like a "real" calculator as much as you can.

Exercise 3: Write a web page and a matching JavaScript file to solve
a quadratic equation of the form "`Ax`

", using the quadratic
forumula. (Look it up in your high school algebra book if you don't remember...) The web page
should have three boxes for use in entering the coefficients "A", "B", and
"C", and a button to click to produce the results. You may display the results in an
alert box, or on the web page, but if you opt for the alert box, you must only have one alert for
all results.^{2} + Bx + C

The following problems are from the book "Python for Everyone" by Cay Horstmann and Rance D. Necaise, ISBN 978-1-118-62613-9.

Exercise 4: (PYTHON PROGRAMMING — Business P2.36) An online bank wants you to create a program that shows prospective clients how their deposits will grow. Your program should read the initial balance and the annual interest rate from the user. Interest is compounded monthly. Print out the balances after the first three months. Write the program in Python (obviously). Here is a sample run of the program:

Initial balance: 1000 Annual interest rate in percent: 6.0 Balance after the first month: 1005.00 Balance after the second month: 1010.03 Balance after the third month: 1015.08

Exercise 5: (PYTHON PROGRAMMING — Business P2.37) A video club wants to reward its best members with a discount based on the member's number of movie rentals and the number of new members referred by the member. The discount is in percent and is equal to the sum of the rentals and the referrals, but it cannot exceed 75 percent. Write a Python program to calculate the value of the discount. Here is a sample run:

Enter the number of movie rentals: 56 Enter the number of members referred: 3 The discount is equal to: 59.00 percent

Exercise 6: (PYTHON PROGRAMMING — Science P2.39) The "dew
point" temperature *T _{d}* can be calculated (approximately) from the relative
humidity

T_{d}= (b * f(T, RH)) / (a - f(T, RH)) where: f(T, RH) = ((a * T) / (b + T)) + ln( RH ) a = 17.27 b = 237.7 degrees C

Write a program that reads the relative humidity (a value between 0 and 1) and the temperature in degrees Celcius, and prints the dew point value. Use the Python function "log()" to compute the natural logarithm (the "ln" in the equation). Check your calculation with a few of the values located at this page. [NOTE: you'll have to convert the temperatures to degrees F.]

Exercise 7: (PYTHON PROGRAMMING — Science P2.43) According to
the Coulomb force law, the electric force between two charged particles of charge *Q _{1}*
and