Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this program you need to take the following data and convert it into an array literal of Javascript object literals, where each object literal

For this program you need to take the following data and convert it into an array literal of Javascript object literals, where each object literal has three properties: a destination, a number of miles, and a number of gallons as shown below. You need to assign the array of objects to a variable, like trips,

Your array of objects cannot contain the mpg value. The value for miles per gallon must be calculated by the function called when the button is clicked.

For full credit:

Use Bootstrap to style the table.

The trip data needs to begin as an array literal of object literals, where each trip is an object with 3 properties.

The button must have an id property, and using getElementById('id') you must assign the function that displays the table to the button using an anonymous function in your JavaScript code.

Rather than use document.write(), you must use createElement() and appendChild(), similar to the example program in the DOM lecture notes.

Before being inserted into a table cell, the mpg must be calculated by the funciton and not be part of the object.

round the calculation to 1 decimal placeimage text in transcribed

Trip Data Display Data Destination Chicago St. Louis Indianapolis Nashville Cincinnati Miles 329 284 191 132 Gallons 10.6 10.5 3.7 6.4 3.9 MPG 31.00 27.0 33.0 29.8 33.8

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

Step: 3

blur-text-image

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

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

Is college worth the cost? Why or why not?

Answered: 1 week ago

Question

2. Why has the conflict escalated?

Answered: 1 week ago

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago