Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an app that provides the day of the week for any date a user enters and make it useable across all browsers. Download and

Create an app that provides the day of the week for any date a user enters and make it useable across all browsers.

Download and unzip the Lab 7 file.

In the index.html file:

Enter your name and today's date where indicated in the comment section in the document head.

Add script tag to access script.js file

In the script.js file:

Add an onclick event handler for the addButton object. Within the event handler do the following:

Use the push() method to add the value of the customerName object to the end of the customers array.

Run the generateCustomerList() function to update the contents of the ordered list that appears on the web page.

Change the text of the status paragraph to "customer added to the end of the queue" where customer is the value of the customerName object.

Add an onclick event handler for the searchButton object. Within the event handler do the following:

Use the indexOf() method to locate the index of the array item whose value equals the value of the customerName object. Add 1 to the index value and store the result in the place variable.

If place is equal to 0, change the text of the status paragraph to "customer is not found in the queue" where customer is the value of the customerName object; otherwise change the text of the status paragraph to "customer found in position place of the queue" where place is the value of the place variable

Add an onclick event handler for the removeButton object. Within the event handler do the following:

Use the indexOf() method to locate the index of the array item whose value equals the value of the customerName object. Store the index in a variable named index.

If index is not equal to -1 then (i) use the splice() method to remove one item from the customers array whose index equal the value of the index variable, (ii) change the text of the status paragraph to "customer removed from the queue", and (iii) call the generateCustomerList() function to recreate the ordered list of customer names. Otherwise, change the text of the status paragraph to "customer is not found in the queue".

Add an onclick event handler for the topButton object. Within the event handler do the following:

Apply the shift() method to remove the first item from the customers array, storing the value returned by the shift() method in the topCustomer variable.

Change the text of the status paragraph to "Top customer from the queue" where Top Customer is the value of the topCustomer variable.

Call the generateCustomerList() function.

Execute the webpage by completing following actions:

Add Michael One to the customer list. Should show up as 26th position

Search for Gene Bearden. Verify he is the 21st entry

Remove John Hilton from the list. Verify the number of customers is now 25

Remove top customer from the list

Search for Peter Blake. Verify the name is not found.

Take a screen capture after completing above steps.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

What is cultural awareness?

Answered: 1 week ago