Question: Let us consider the following XML document containing information about average daily temperatures at various cities in different days: 2021-01-01 Dearborn 24 Detroit 20 Ann

Let us consider the following XML document containing information about average daily temperatures at various cities in different days:

2021-01-01 Dearborn 24 Detroit 20 Ann Arbor 28 Flint 26 2021-01-02 Dearborn 22 Detroit 17 Ann Arbor 25 Flint 21

The following is a JSON document containing the same information:

{ weather: [ {city:Dearborn, date: 2021-01-01, temperature:24}, {city:Detroit, date: 2021-01-01, temperature:20}, {city:Ann Arbor, date: 2021-01-01, temperature:28}, {city:Flint, date: 2021-01-01, temperature:26} {city:Dearborn, date: 2021-01-02, temperature:20}, {city:Detroit, date: 2021-01-02, temperature:17}, {city:Ann Arbor, date: 2021-01-02, temperature:25}, {city:Flint, date: 2021-01-02, temperature:21} ] }

In this project, we assume that all XML and JSON documents follow the exact format shown in the example given above. However, your implementation should work for any data included in the documents. For example, the documents may include additional dates and cities as well as different values for the temperatures.

Implement a program that asks the user to provide either a JSON or XML document and displays the average temperature (across all cities) for each day. You are allowed to use the programming language of your choice

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!