I’m trying to figure out what I’m doing wrong with this assignment my solution a
ID: 3729686 • Letter: I
Question
I’m trying to figure out what I’m doing wrong with this assignment my solution and my professors feed at the bottom. Also need the html thanks for any helpcreate a function that accepts data from outside the function, and use the data that is passed to it within the body of the function.
The data that is passed to the function will be a line of the countdown to be displayed on the web page.
= = = = = = = = = = = = = = = = = Although your program displays the alerts and the countdown on the web page, some restructuring of the program logic is needed for 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 the feedback I provided for assignment 2 regarding general-purpose functions, try to create a general-purpose function like the one I showed. Modify that function to display both the alert message and the line to the web page.
In the program below, replace each pair of function calls to document.write and window.alert with a function call to your newly created general-purpose function (which will do the work of displaying the alert and writing the line to the web page.)
To review: the program should have one function that does the work of displaying a line on the web page followed by an alert message. The program should call that function from within a for-loop to display the numeric part of the countdown. After the loop terminates, the program should call that function to display the last 3 lines of the countdown. After making the necessary modifications and testing your program, resubmit the assignment for grading.
Assignment 3 instructions: 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 textbook: 1. Create two files, one named third.html and the other named third.js 2. 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!
3. Each line must be displayed on the web page. 4. An alert must be used to control when the next line displays. 5. Create a general purpose function that outputs one line of the countdown on the web page, followed by an alert, and receives the data to output via an input parameter. 6. Use that function to output each line of the countdown, followed by an alert. 7. Each line after the first line, will display after the user clicks "ok" in response to the alert. 8. 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.) 9. Use comments and lay the code out so it can be easily followed.
for (var count=10; count >= 1; count--) { window.alert("Click Ok!"); document.write(count+"<br />") }
window.alert("Click Ok!") document.write("Liftoff<br />") window.alert("Click Ok!") document.write("We Have Liftoff!<br />")
I’m trying to figure out what I’m doing wrong with this assignment my solution and my professors feed at the bottom. Also need the html thanks for any help
create a function that accepts data from outside the function, and use the data that is passed to it within the body of the function.
The data that is passed to the function will be a line of the countdown to be displayed on the web page.
= = = = = = = = = = = = = = = = = Although your program displays the alerts and the countdown on the web page, some restructuring of the program logic is needed for 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 the feedback I provided for assignment 2 regarding general-purpose functions, try to create a general-purpose function like the one I showed. Modify that function to display both the alert message and the line to the web page.
In the program below, replace each pair of function calls to document.write and window.alert with a function call to your newly created general-purpose function (which will do the work of displaying the alert and writing the line to the web page.)
To review: the program should have one function that does the work of displaying a line on the web page followed by an alert message. The program should call that function from within a for-loop to display the numeric part of the countdown. After the loop terminates, the program should call that function to display the last 3 lines of the countdown. After making the necessary modifications and testing your program, resubmit the assignment for grading.
Assignment 3 instructions: 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 textbook: 1. Create two files, one named third.html and the other named third.js 2. 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!
3. Each line must be displayed on the web page. 4. An alert must be used to control when the next line displays. 5. Create a general purpose function that outputs one line of the countdown on the web page, followed by an alert, and receives the data to output via an input parameter. 6. Use that function to output each line of the countdown, followed by an alert. 7. Each line after the first line, will display after the user clicks "ok" in response to the alert. 8. 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.) 9. Use comments and lay the code out so it can be easily followed.
for (var count=10; count >= 1; count--) { window.alert("Click Ok!"); document.write(count+"<br />") }
window.alert("Click Ok!") document.write("Liftoff<br />") window.alert("Click Ok!") document.write("We Have Liftoff!<br />")
I’m trying to figure out what I’m doing wrong with this assignment my solution and my professors feed at the bottom. Also need the html thanks for any help
create a function that accepts data from outside the function, and use the data that is passed to it within the body of the function.
The data that is passed to the function will be a line of the countdown to be displayed on the web page.
= = = = = = = = = = = = = = = = = Although your program displays the alerts and the countdown on the web page, some restructuring of the program logic is needed for 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 the feedback I provided for assignment 2 regarding general-purpose functions, try to create a general-purpose function like the one I showed. Modify that function to display both the alert message and the line to the web page.
In the program below, replace each pair of function calls to document.write and window.alert with a function call to your newly created general-purpose function (which will do the work of displaying the alert and writing the line to the web page.)
To review: the program should have one function that does the work of displaying a line on the web page followed by an alert message. The program should call that function from within a for-loop to display the numeric part of the countdown. After the loop terminates, the program should call that function to display the last 3 lines of the countdown. After making the necessary modifications and testing your program, resubmit the assignment for grading.
Assignment 3 instructions: 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 textbook: 1. Create two files, one named third.html and the other named third.js 2. 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!
3. Each line must be displayed on the web page. 4. An alert must be used to control when the next line displays. 5. Create a general purpose function that outputs one line of the countdown on the web page, followed by an alert, and receives the data to output via an input parameter. 6. Use that function to output each line of the countdown, followed by an alert. 7. Each line after the first line, will display after the user clicks "ok" in response to the alert. 8. 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.) 9. Use comments and lay the code out so it can be easily followed.
for (var count=10; count >= 1; count--) { window.alert("Click Ok!"); document.write(count+"<br />") }
window.alert("Click Ok!") document.write("Liftoff<br />") window.alert("Click Ok!") document.write("We Have Liftoff!<br />")
Explanation / Answer
Hello friend, Thanks for the question.
You almost completed the assignment.The only mistake that you did is you did not use functions.I have explained that using comments.Please go thorugh it.
Put both the files in same directory or folder.
1.third.js
//general function to write the count down on webpage and to alert
function writeAndAlert(count){
let userAction = window.confirm("Click Ok to continue the count down timer!");
document.write(count+"<br />");
return userAction;
}
//function to dispaly after count down is completed
function finalExcution(){
window.alert("Click Ok!");
document.write("Ignition Start <br />");
document.write("Liftoff<br />");
window.alert("Click Ok!");
document.write("We Have Liftoff!<br />");
}
//Main function where the excution starts
function start(limit){
for (var count=limit; count >= 1; count--) {
//if user clicks ok then only continue the count down timer
//else break the loop
if(!writeAndAlert(count)) return false;
}
return true;
}
//invoke the main function .
if(start(10)){
finalExcution();
}
else{
document.write("User Clicks Cancel So count down timer stopped in the middle");
}
2.third.html
<html>
<title>
NASA Type Count Down
</title>
<head>
<script type="text/javascript" src="third.js"> </script>
</head>
<body>
</body>
</html>
Have a nice day
If you like my answer, Don't forget to accept the answer and please give rating...
Once again thank you...
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.