Week 2
Practice creating scripts: working with Variables, Loops, Functions, Events, Time/date, Swapping images, Slide show etc.
Lecture: JavaScript Events
Start working on Preliminary final project design
Discuss Midterm test/project
In Class Activity -- A Tip Calculator
Objectives:
* to write a program that makes use of numbers and the input-processing-output pattern
* to practice producing nicely-formatted output that mixes data with text information
Instructions:
Create a JavaScript program that serves as a tip calculator for a restaurant patron. The program should ask the user to provide 2 pieces on information: the amount of the bill and the percentage tip desired. Then, the program should write some nicely-formatted information to the web page that includes 4 pieces of information:
* the dollar amount of the bill (provided by the user)
* the percentage tip (provided by the user)
* the dollar amount of the tip, rounded to the nearest penny (calculated)
* the total amount to pay, including the tip (calculated)
Your program should follow the input-processing-output pattern - get user data, process user data, output processed data for the user.
** Don't forget to convert the user inputs from strings into numerical data before trying to use the values in calculations.
References: Lab 1 and HeadFirst JavaScript 1 - 6.
Labs
Lab 3 - In Class: Tip Calculator
Lab 4
(mouseover tutorial, multiple rollover tutorial, slideshow tutorial)
Readings
HeadFirst JavaScript 4 - 6