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:
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started