Question

In: Computer Science

Use a JSON data structure that contains student information (StudentId, FName, LName, Address, City, State, Zip,...

Use a JSON data structure that contains student information (StudentId, FName, LName, Address, City, State, Zip, E-mail, Phone, Major, AdvisorName, AdvisorEmail).

Using the Foreach statement, display all the contents of the JSON data structure into a webpage.

What to turn in:

1. Screenshots: Code, JSON data, Web page showing JSON data in a table - pulled using the Foreach instruction.

Solutions

Expert Solution

1). ANSWER :

GIVENTHAT :

CODE :

datastructure.js

//JSON data structure is a collection of objects
//It consists of name : value pairs
//Names should be in double quotes
//Values with string values should be in double quotes and numbers
//can be specified without quotes
//{ } braces contains collection of name : value pairs i.e., objects
var datastructure = {
           "StudentId" : 1234,
           "FName" : "John",
           "LName" : "Doe",
           "Address" : "Street No.1 Lane 23 Fold",
           "City" : "Cumerics",
           "State" : "Washington",
           "Zip" : 12345,
           "Email" : "[email protected]",
           "phone" : 123456789,
           "Major" : "abcd",
           "AdvisorName" : "Holmes",
           "AdvisorEmail" : "[email protected]" }

data.html

<!DOCTYPE html>
<html>
<head>
<title>JSON Datastructure</title>
<!--Linking datastructure.js file -->
<script src="datastructure.js"></script>
</head>
<body>
   <h1>Data Taken from JSON Data Structure</h1>
<h3 id="result"></h3>
<script>
//Displaying the data in html element
//Getting a html element via its ID
var result = document.getElementById("result");
//Displaying data
//Looping through each object in the datastructure
//Displaying name and values
for( i in datastructure){
   result.innerHTML += i + " : " + datastructure[i] + "<br/>";
}
</script>
</body>
</html>

SCREENSHOTS :

Please see the screenshots of the code for the indentations of the code.

(datastructure.js)

(data.html)

OUTPUT :


Related Solutions

1. The functional dependencies for the ProAudio relation: c_id -> f_name, l_name, address, city, state, zip...
1. The functional dependencies for the ProAudio relation: c_id -> f_name, l_name, address, city, state, zip item_id -> title, price ord_no -> c_id, order_date ord_no  + item_id  -> shipped zip -> city, state Original ProAudio relation: c_id f_name I_name address city state zip ord_no item_id title price order_date shipped 01 Jane Doe 123 Elm St Ely NV 11111 1-1 12-31 More Blues 8.99 12-2-00 no 02 Fred Fish 321 Oak St Ely NV 11111 2-1 21-12 Jazz Songs 9.99 11-9-00 yes 01...
1. The functional dependencies for the ProAudio relation: c_id -> f_name, l_name, address, city, state, zip...
1. The functional dependencies for the ProAudio relation: c_id -> f_name, l_name, address, city, state, zip item_id -> title, price ord_no -> c_id, order_date ord_no  + item_id  -> shipped zip -> city, state Original ProAudio relation: c_id f_name I_name address city state zip ord_no item_id title price order_date shipped 01 Jane Doe 123 Elm St Ely NV 11111 1-1 12-31 More Blues 8.99 12-2-00 no 02 Fred Fish 321 Oak St Ely NV 11111 2-1 21-12 Jazz Songs 9.99 11-9-00 yes 01...
I need some information on how to show the code to create a JSON data structure...
I need some information on how to show the code to create a JSON data structure with food, calories, fat, protein. while using PHP. as well as be able to add an additional value through a text box if possible. The program only needs to read the json data in program and show output in the console I would like the data to be shown in a table once its been compiled.
Consider the following data.    STUDENT StudentID SName Gender Age ClubID 3234 Alfred Smith Male 20...
Consider the following data.    STUDENT StudentID SName Gender Age ClubID 3234 Alfred Smith Male 20 BSK 2244 McJohnson Robert Male 22 2389 Jessica Low Female 20 JPA 4211 Roland Devingo Male 24 4383 Jane Usa Khan Female 21 BKY 4450 Elaine Fong Female 20 JPA CLUB ClubID CName Founded Budget BKY Bakery Club 2010 2546 PDC Photomedia and Design 2005 1345 JPA Japanese Anime 2009 3453 BSK Basketball 2011 6744 If the database administrator in the University has turned...
Consider the following data.    STUDENT StudentID SName Gender Age ClubID 3234 Alfred Smith Male 20...
Consider the following data.    STUDENT StudentID SName Gender Age ClubID 3234 Alfred Smith Male 20 BSK 2244 McJohnson Robert Male 22 2389 Jessica Low Female 20 JPA 4211 Roland Devingo Male 24 4383 Jane Usa Khan Female 21 BKY 4450 Elaine Fong Female 20 JPA CLUB ClubID CName Founded Budget BKY Bakery Club 2010 2546 PDC Photomedia and Design 2005 1345 JPA Japanese Anime 2009 3453 BSK Basketball 2011 6744 What is the value returned by this SQL statement?...
Database Normalize the relations to BCNF: Member- (MemID, dateJoined, firstName, lastName, street, city, state, zip, areaCode,...
Database Normalize the relations to BCNF: Member- (MemID, dateJoined, firstName, lastName, street, city, state, zip, areaCode, phoneNumber, currentOfficeHeld) Play- (title, author, numberOfActs, setChanges) Sponsor- (sponID, name, street, city, state, zip, areaCode, phoneNumber) Subscriber- (subID, firstName, lastName, street, city, state, zip, areaCode, phoneNumber) Production- (prodyear, seasonStartDate, seasonEndDate, title) Performance – (perfyear,perfdate, time, seasonStartDate) TicketSale- (saleID, saleDate, totalAmount, perfyear, perfdate,subID) DuesPayment- (MemID, duesYear, amount, datePaid) Donation – (sponID, donationDate, donationType, donationValue, prodYear, seasonStartDate) Ticket- (saleID, seatLocation, price, type) Member - Production-(MemID, prodYear,...
Use the data in the Mod8-2Data file to answer the following questions. The data contains information...
Use the data in the Mod8-2Data file to answer the following questions. The data contains information from a car seat manufacturer on the age of machine (in months) and the cost of repairs (in 10s of $). Run the regression in Minitab and show the regression line on a scatter plot. Assume a level of significance of 5%. Age Repairs10 110 32.767 113 37.668 114 39.252 134 44.314 93 34.262 141 47.616 115 32.474 115 33.898 115 43.345 142 52.637...
SQL statmen: List the first name, the last name, the address, the city, the state, the...
SQL statmen: List the first name, the last name, the address, the city, the state, the branchNo, and the email of agents working in the branch B005 and having email addresses ending with extensions different from .com.
Inheritance – Address, PersonAddress, BusinessAddress Classes Assignment Download the Lab6.zip starter file. Use 7zip to unzip...
Inheritance – Address, PersonAddress, BusinessAddress Classes Assignment Download the Lab6.zip starter file. Use 7zip to unzip the file using ‘Extract Here’. Open the project folder in IntelliJ. Examine the Main and Address classes. You are going to add two classes derived from Address: BusinessAddress and PersonAddress. Create BusinessAddress class Select package edu.cscc and create a new Java class called BusinessAddress   Make the class extend the Address class Add two private String fields businessName and address2 Generate constructor and all getters...
The crab data set contains information on the number of "satellites" per female crab. Use a...
The crab data set contains information on the number of "satellites" per female crab. Use a Bayesian model to infer the Poisson parameter. a.  Write the likelihood function. b. Derive the posterior distribution using a Gamma prior w/ rate=20 & shape=3 c. Provide the posterior mean, posterior SD and 95 and 99% posterior credibility region (hint: you can use qgamma). d. Plot the prior and posterior distribution of lambda, in the same plot. mean = 2.919075 variance = 9.912018 n =...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT