What the book refers to as conditional statements and loops

Assignment Help JAVA Programming
Reference no: EM131143331

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.

Reference no: EM131143331

Questions Cloud

What a section of the rubric on a paper : What a section of the rubric on a paper. - I have attached my paper below. - The topic is: "Nursing and Patient Care Models"
Determine two disadvantages resulting from placing : Determine two disadvantages resulting from placing the right people into the wrong job. Next, provide two (2) HRM selection decisions that an organization can use to mitigate this issue. Justify your response.
Create restaurant business plan-decision alternatives : Decision Alternatives: Describe the process used to determine alternatives, including a discussion of other alternatives that seem relevant and the reasons these were not analyzed. Describe the final set of alternatives used in the decision analysis...
Many layers of cost does your organization impose : If you walk into a UPS store and ship a box, you will not fill out a paper form. The associate will type the name and address into the UPS register. If you walk into a FedEx store to ship a similar box, you will complete a form. but how many layers o..
What the book refers to as conditional statements and loops : Create two files, one named third.html and the other named third.js What the book refers to as "Conditional Statements and Loops" is normally called flow control by programmers.
What federal and shareholder requirements : Compliance A. While investigating the shares offered to you by your potential boss, you discover that the company you are considering working for is not registered as required under the Securities Act of 1933. what federal and shareholder requirement..
List examples of new processes that could be used or process : Be specific about plant parameters such as flows, temperatures, and pressures in your examples. Tables and figures (including charts and graphs) should be used if they would be helpful in the explanation. Any cautions or concerns should also be in..
Highly efficient and reducing costs of operation : What is the foremost thing that occupies the attention of you and your fellow associates? Is there a passion for managing one's career as a primary objective, being highly efficient and reducing costs of operation, or is it a focus on the customer?
Evaluate different operations management principles : Evaluate different operations management principles and techniques that can make businesses more profitable today. Select one service company of your choice and discuss at least three operations management challenges the company is facing. Suggest wa..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a program that reads in a list of numbers from a file

write a program that reads in a list of numbers from a file and adds up all those numbers. You may hard code in the name of the file, allowing the user to input the filename is not required

  Calculate the average of two values

Write a program to calculate the average of two values. Initialize the two values to be averaged in main. Pass these two values as parameters on the stack to the average procedure.

  Difference for class linked bag and test into main program

write a method difference for the class linked bag and test into main program.

  Write, compile and run a standalone java application

Write, compile and run a standalone Java application that displays an output line on the console.

  Write a java applet for grade of gas in costco gas station

Write a java applet (not a java application program) for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use.

  Create an employee class.

Create an Employee class. Items to include as data members are employee number, name, date of hire, job description, department, and monthly salary.

  Creates a file called "grades.txt" with 1000 lines

Write a program that creates a file called "grades.txt" with 1000 lines. Each line in the "grades.txt" file will consist of a student's first name, last name, graduating year(2013,2014,2015), and grade. the student's first name and last name for t..

  Write a program to print out a simplified bill

Write a program to print out a simplified bill. The customer's name, the number of hours of labor, and the cost of parts and supplies should be entered in response to INPUT statements.

  Develop a basic android weather application

Develop a basic Android "Weather Application". Your application should have a single view with a list of cities (see below) and the current temperature at that location.

  Loops-for loop, while loop, and do while loop

There are 3 kinds of loops-for loop, while loop, and do while loop. Under which circumstances would each kind of loop be more appropriate

  Concepts of interfaces and inheritance

In this assignment we will work with the concepts of interfaces and inheritance. We will make use of a extends to create an inheritance hierarchy, and use implements to implement an interface that allows properties to be added to objects at run-ti..

  Examples of cultural productions from three cultures

Using specific examples of cultural productions from three cultures -Sumerians, Archaic Greeks (800-480 BCE), Classical Greeks (480-323 BCE)- explain how cultural values and ideals are reflected in the creation and style of cultural productions.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd