Exercise 1:

Create a function and button which allows a user to enter baggage weight and alerts them if the baggage exceeds the allowance of 15kg

Hello World!

Exercise 2:

Create a page with a button

When the user clicks,

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000 and alert the user to the correct answer.

The prompt:

Exercise 3, Functions:

Create a page with a button and three input boxes, labelled a, b and n

When the user clicks,

Create a function to return the sum of all the multiples of a or b below n

Call the function and alert the user to the correct answer when they press the button.

Exercise 4, Arrays: f4 should take 2 integer and 1 array parameters and return an integer.

Create a function f4 to return the sum of all the multiples of a or b in array l

(Exercise 4.1) Create a page with a button and three input boxes, labelled a, b and l, l should be a large input

Call the function f4 in the function called by onClick, and alert the user to the returned answer when they press the button.

Exercise 5, Arrays: f5 should take array parameters and return an integer.

Create a function f5 to return the sum of all the multiples of factors in a found in in l (a and l should be arrays of integers, a is of length 2)

(Exercise 5.1) Create a page with a button and two wide input boxes, labelled a and l

Call the function f5 in the function called by onClick, and alert the user to the returned answer when they press the button.

You may find the split function useful for creating arrays from the strings entered: Split

Exercise 6, Arrays: f6 should take array parameters and return an integer.

Create a function f6 to return the sum of all the multiples of factors in a found in in l (a and l should be arrays of integers)

(Exercise 6.1) Create a page with a button and two wide input boxes, labelled a and l

Call the function f6 in the function called by onClick, and alert the user to the returned answer when they press the button.

You may find the split function useful for creating arrays from the strings entered: Split

Exercise 7, Objects as dictionaries/hashtables:

Create a function, f7, that takes two parameters, basket and prices

f7 should compute the cost of the basket given the prices supplied.

basket should be an object holding product:quantity (string:int) pairs

prices should be an object holding product:price (string:float) pairs

==7.1==

Create a testing page for the function f7