a)
To declare a countdown() function, which will update the minsLeft, secsLeft, and timeLeft variables every second. This function should not have any parameters and it should calculate a new value for the minsLeft variable by dividing the timeLeft variable by 60 and using the Math.floor()method to round that value down to the next lowest integer in file ph_clock.js.
b)
To calculate the new value for the secsLeft variable which is equal to the value of the timeLeft variable minus 60 times the minsLeft variable within the countdown()function in file ph_clock.js.
c)
To create a minsString variable and setting its value equal to the value returned by the addLeadingZero() function by using minsLeft as the parameter value within the countdown()function in file ph_clock.js.
d)
To create a secsString variable and setting its value equal to the value returned by the addLeadingZero() function by using secsLeft as the parameter value within the countdown()function in file ph_clock.js.
e)
To change the text content to the value of the minsString variable within the element with the id minutes and to change the text content to the value of the secsString variable within the element with the id seconds within the countdown()function in file ph_clock.js.
f)
To call the checkTimer()function within the countdown()function in file ph_clock.js.
g)
To declare a decrement operator to decrease the value of the timeLeft variable by 1 within the countdown()function in file ph_clock.js.
Trending nowThis is a popular solution!
Chapter 9 Solutions
New Perspectives on HTML5, CSS3, and JavaScript
- Program Specifications Write a FancyCar class to support basic operations such as drive, add gas, honk horn and start engine. fancy_car.py is provided with function stubs. Follow each step to gradually complete all instance methods. Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress. The main program includes basic calls to the instance methods. Add statements in the main program as instance methods are completed to support development mode testing. **Step 0: Complete the constructor to initialize the model and miles per gallon (MPG) with the values of the parameters. Initialize the odometer to five miles and the tank to be full of gas. By default, the model is initialized to "Old Clunker", and MPG is initialized to 24.0. Note the provided constant variable indicates the gas tank capacity of 14.0 gallons. Step 1 Complete the instance…arrow_forwardCreate Automatic Variables.arrow_forwardAdd formulasto complete the table of hours used. In cell B17, create a nested formula with the IFand SUMfunctions that check if the total number of hours worked in week 1 (cells B9:F9) is equal to 0. If it is, the cell should display nothing (indicated with two quote marks: ""). Otherwise, the cell should display the total number of hours worked in week 1. Copy the formula from cell B17 to fill the range B18:B20.arrow_forward
- Write the parameterList for a procedure that receives a Decimal value followed by the address of a Decimal variable. Use decSales and decBonus as the parameter names.arrow_forwardWhich delimiter will be selected to change the text 'Happy#go#lucky' in to column? a. tab b. semicolon c. other d. spacearrow_forwardMost forms on websites will usually have some sort of test to confirm that the user is a human and not a bot. Update the contact form that you created in Part 3. Add a field to the form that asks the user for the answer to a simple maths problem. The form should only be submitted if the user provides the successful answer to the maths problem. For example you may ask the user what 3 + 4 equals. The form will only be successfully submitted if the user provides 7 as the answer. If the user provides the incorrect answer to the maths problem, you should display a bold red error message to the user on the page by manipulating the DOM. The message should be diplayed in the same location on the page as the form validation error message from Part 3. If the user provides the correct answer to the maths problem, then the form should be submitted and the user should receive the bold green success message from part 3. Once part 4 is complete the user should receive an error message if: • The form…arrow_forward
- • Use a while loop • Use multiple loop controlling conditions • Use a boolean method • Use the increment operator • Extra credit: Reuse earlier code and call two methods from main Details: This assignment will be completed using the Eclipse IDE. Cut and paste your code from Eclipse into the Assignment text window. This is another password program. In this case, your code is simply going to ask for a username and password, and then check the input against four users. The program will give the user three tries to input the correct username-password combination. There will be four acceptable user-password combinations: • alpha-alpha1 • beta-beta1 • gamma-gamma1 • delta - delta1 If the user types in one of the correct username-password combinations, then the program will output: "Login successful." Here are a couple of example runs (but your code needs to work for all four user-password combinations): Username: beta Type your current password: beta1 Login successful. Username: delta Type…arrow_forwardCreate a data type that allows you to insert, remove the maximum, and delete the minimum (all in logarithmic time), as well as locate the maximum and find the minimum (both in constant time). Use two piles as a hint.arrow_forwardIn the following procedure, the parameter age represents a person's age. The procedure is intended to return the name of the age group associated with age. People who are under 18 are considered minors, people who are 65 and older are considered senior citizens, and all other people are considered adults. The procedure does not work as intended. Line 1: PROCEDURE ageGroup(age) Line 2: } result "adult" Line 3: Line 4: IF(age 65) Line 5: { Line 6: result "senior citizen" Line 7: Line 8: RETURN(result) Line 9: Line 10: result "adult" Line 11: IF(age < 18) Line 12: Line 13: result "minor" Line 14: Line 15: RETURN(result) Line 16: } ill cause the procedure to work as intended?arrow_forward
- • Created two dictionaries: • days, which uses the numbers 1-7 as the keys and "Sunday", "Monday",..."Saturday" as the values. • months, which uses the numbers 1-12 as the keys and "January", "February", ... "December" as the values. • Asked the user to enter a day (1-31), a month (1-12), a year, and a day of the week (1-7). You could assume the user entered valid numbers. Using the dictionaries, printed the date in the form "Monday, October 12, 2020" • Modify this program so that there is a function for each required input, that will test that the user has entered a valid number. • The function getting the month should accept any number between 1 and 12. • The function getting the day of the week should accept any number between 1 and 7. • The function getting the day of the month should test that the day is valid for a given month (pass the month to the function). For example, if month=-4 (April), 31 would not be accepted. • The function asking for the year should test for a…arrow_forwardPresent the user with a list of top Sega games, then prompt the user for which one they would like to remove, and then show the list again. The list of games is: Mortal Kombat, Contra, Streets of Rage, Shinobi, Sonic, Phantasy Star. Expected Output Here are the top Sega games: Mortal Kombat Contra Streets of Rage Shinobi Sonic Phantasy Star Which one do you think should be remove Here are the new top Sega games: Mortal Kombat Streets of Rage Shinobi Sonic Phantasy Stararrow_forwardPlease help me figure out what I’m doing wrong (JavaScript)arrow_forward
- New Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage LearningCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L