use a JSON data structure which 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.
Here is the answer for your question using HTML and JavaScript(JSON) Languages.
NOTE : datatstructure.js file contains the JSON datastructure and data.html will display the data in datastructure.js.
Please see the comments in each line for better understanding
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 :
Any doubts regarding this can be explained with pleasure :)
use a JSON data structure which contains student information (StudentId, FName, LName, Address, City, State, Zip,...
CUSTTYPE (TID, TypeDesc) CUSTOMER (CID, Lname, Fname, TID, Address, ZIPcode) CUSTORDER (OrderNo, OrderDate, PromiseDate, ShippedDate, ShippingTerm, SalesID, CID) SALESREP (SalesID, Name, Phone, Address, ZIPcode, RepType) ORDERLINE (OrderNo, PID, Qty, Qty_RETD) FTSALESREP (SalesID, MonthPay, Rank) PTSALESREP (SalesID, HourlyRate, WeekHours) ZIP_TABLE (ZIPcode, City, State) VENDOR (VID, Name, Phone ZIPcode) PRODUCT (PID, CateID, ProdName, ProdFinish, Price, Qty_on_Hand, Description, VID) CATEGORY (CateID, CateType) Local View #1: Use three base tables to develop a SQL statement that will list the following information for a customer,...
Write a program that uses a structure to store the following data about a customer account: Name Address City, state, and ZIP Telephone number Account Balance Date of last payment The program should use an vector of at least 20 structures. It should let the user enter data into the vector, change the contents of any element, and display all the data stored in the array. The program should have a menu-driven user interface. Input Validation: When the data for...
For the below `bank' schema: customer(customerid,username,fname,lname,street1,street2,city,state,zip) account(accountid,customerid,description,) transaction(transactionid,trantimestamp,accountid,amount) A customer may have several accounts, and each account may participate in many transactions. Each transaction will have at least two records, one deducting amount from an account, and one adding amount to an account (for a single transactionid, the sum of amounts will equal zero). Using SQL, answer these questions (write a SQL query that answers these questions): 8) List the top 1% of customers (ordered by total balance). 9) Using...
MySQL Practice Student StudentID FirstName LastName Street City State Zipcode 10001 Bruce Wayne 123 Elm Street Gotham City New York 10028 10002 Peter Parker 456 Corallville New York New York 10037 10003 Tony Stark 777 Faith Ave Malibu California 60263 School SchoolID SchoolName City State Zipcode 19837 Gotham High School Gotham City New York 10028 83649 Midtown High School New York New York 10037 73934 MIT Cambridge Massechusetts 02139 Attendee AttendeeID StudentID 100 10001 200 10002 300 10003 Attend AttendeeID...
Create three or more MySQL Data Control language (DCL) Statements using the Youth League Database. 1. A Create new user statement for the database 2. A statement that grants privileges to the new user 3. A statement that revokes privileges 1. A SQL Text File containing the SQL commands to create the database, create the table, and insert the sample test data into the table. 2. A SQL Text File containing the DCL SQL Statements. eted hemas Untitled Limit to...
Write a Java program which will store, manipulate, and print student registration information. As part of the solution, identify the following classes: Student Admissions. The class Student must have the following fields – Name, Address, Id number, Courses, and Date, where: Name is a user defined class comprising of at minimum first name and last name. Address is a user defined class comprising of fields - street, city, state, and zip code. Date is a predefined class in the java.util...
For the below questions, use the following schema definition. customer(custid,lname,fname,street,city,state,zip,dob) device(devid,custid,type) device_onoff(ts,devid,pwr) device_chnl(ts,devid,chnl) schedule(start_ts,end_ts,chnl,showid) This is a schema for a tv network. Customers own devices (of a certain type; phone is a device, cable-box is a device, etc.), and they can watch channels on those devices. Whenever a device comes online, we get a device onoff event, indicating device power state. Whenever a device channel changes, we get a device chnl event. There is also a schedule object, which tells...
Develop a set of classes for a college to use in various student service and personnel applications. Classes you need to design include the following: • Person — A Person contains the following fields, all of type String: firstName, lastName, address, zip, phone. The class also includes a method named setData() that sets each data field by prompting the user for each value and a display method that displays all of a Person’s information on a single line at the...
In this assignment, you will create an application that holds a list of contact information. You will be able to prompt the user for a new contact, which is added to the list. You can print the contact list at any time. You will also be able to save the contact list. MUST BE IN PYTHON FORMAT Create the folllowing objects: ContactsItem - attributes hold the values for the contact, including FirstName - 20 characters LastName - 20 characters Address...
9 We want to find out the courses that each student is not enrolled in. Give a listing of the course descriptions, and the students (lname) who are not taking that specific course (Use a cartesian product and union it with a minus) drop table student_class; drop table student; drop table class; create table student ( ssn char(11) not null, lname varchar(40) not null, fname varchar(20) not null, phone char(12), address varchar(40), city varchar(20), state char(2), zip char(5), dob date,...