Create two files one named thirdhtml and the other named


Assignment1

Now that we know about variables and functions, it's time to learn about doing real things with variables and functions.

To do that, we need to be able to do things like add, subtract, multiply, and so on to variables and we need to be able to make decisions about what to do based on the results.

What the book refers to as "Conditional Statements and Loops" is normally called flow control by programmers.

So far, the assignments have required you to write instructions for each line a JavaScript statement or function outputs. If the assignment was changed to require 20 down to 0 rather than 10 down to 0, you would have to write at least 10 more lines of code to make the program do what is required.

With flow control, you can make decisions based on variables and write code that lets you execute a single statement, or a group of statements that change their actions based on passed parameters (variables).

Once you understand flow control, you are ready to write useful programs that don't need to be rewritten each time something changes.

Be sure to fully understand chapters one through six of the book, and make sure you can answer all the questions at the back of those chapters before going to the next slide!

The purpose of the assignment is to demonstrate your ability to use operators and flow control logic, and to create a function which accepts an input parameter, and uses the data passed to the function.

Using only the techniques from modules one through three, and chapters one through six of the book:

Create two files, one named third.html and the other named third.js

Write code to create a web page that uses a JavaScript program to output a NASA style count down:

Ten

Nine

...

One

Ignition Start

Liftoff

We have Liftoff!

Each line must be displayed in the browser window.

An alert must be used to control when the next line is displayed.

Create a generic function that outputs one line of the countdown on the web page, followed by an alert, and receives the data to output as an input parameter.

Use that function to output each line of the countdown, and an alert.

Please note that you are outputting the countdown to the browser window this time, not to an alert! The alert is only being used to signal when to output the next line.

Important Note: Depending on which browser you are using to view your web page, the alert messages may or may not be displayed alternately with each line output to the web page. Some browsers (Internet Explorer) display all the alerts first and then display the countdown on the page.

The program should have fewer lines of code than assignment 2. Hint: use a loop when displaying the numeric part of the countdown. You can output the countdown numbers as before or as digits (Ten or 10, Nine or 9, etc.)

Use comments and lay the code out so it can be easily followed!

Each file in the assignment must have a comment at the top, using the correct commenting technique for the file type, like this:

Your Name

Your Student ID

CST140

Assignment 2

Test your program by opening the web page in your browser. You should see the NASA countdown displayed on the Web page, and a series of alerts. Click the OK button to display the next line in the countdown.

Important Note: Depending on which browser you are using to view your web page, the alert messages may or may not be displayed alternately with each line output to the web page. Some browsers (Internet Explorer) display all the alerts first and then display the countdown on the page.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create two files one named thirdhtml and the other named
Reference No:- TGS01526668

Now Priced at $40 (50% Discount)

Recommended (96%)

Rated (4.8/5)