Background Who's in Space The following URL provides information about all the people who are currently...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Background Who's in Space The following URL provides information about all the people who are currently in space. http://api.open-notify.org/astros.json Paste the URL into a web browser and examine the JSON data that is returned. Assignment Download the Lab 7 starter project, unzip it with 7-zip and "Extract Here", and import it into Eclipse. You are going to write a program that accesses the above URL's to display the number of people currently in space as well as a detailed list of who is in space and where they are (usually the International Space Station). Write the program in three steps: 1. Write Java code to read input from the supplied URL into a single String. Output the String to verify the program works correctly. 2. Use the supplied org.json library (already included in the starter project) to parse the JSON and determine a count of the number of people in space. Output that value (with appropriate text labeling). 3. Use the supplied org.json library to parse the list of people in space and their location. Output that information. Example Output Note: output may differ from the results below as the list of people in space changes over time. {"message": "success", "number": 10, "people": [{"craft": "ISS", "name": "Sergey Ryzhikov"}, {"craft": "ISS", "name": "Kate Rubins"}, {"craft": "ISS", "name": "Sergey Kud-Sverchkov"}, {"craft": "ISS", "name": "Mike Hopkins"}, {"craft": "ISS", "name": "Victor Glover"}, {"craft": "ISS", "name": "Shannon Walker"}, {"craft": "ISS", "name": "Soichi Noguchi"}, {"craft": "ISS", "name": "Mark Vande Hei"}, {"craft": "ISS", "name": "Oleg Novitskiy"}, {"craft": "ISS", "name": "Pyotr Dubrov"}]} There are 10 people in space Sergey Ryzhikov is onboard: ISS Kate Rubins is onboard: ISS Sergey Kud-Sverchkov is onboard: ISS Mike Hopkins is onboard: ISS Victor Glover is onboard: ISS Shannon Walker is onboard: ISS Soichi Noguchi is onboard: ISS Mark Vande Hei is onboard: ISS Oleg Novitskiy is onboard: ISS Pyotr Dubrov is onboard: ISS Package Explorer X Project Explorer ✓Lab7 src W #edu.cscc V V Main.java Main main(String[]): void module-info.java AstrosSolution > Referenced Libraries > JRE System Library [jdk-11.0.9.11-hotspot] lib json-20210307.jar *module-info.java X 1 module AstrosSolution { requires org.json; 123 3} Problems X @Javadoc Declaration Coverage 12 errors, 9 warnings, 0 others Description *Main.java X 2-import java.io. BufferedReader; 3 import java.io.IOException; 4 import java.io.InputStreamReader; 5 import java.net.MalformedURLException; 6 import java.net. URL; 7 import java.net. URL Connection; 8 import java.util.ArrayList; 9 import org.json. *; 10- /** 11 12 13 */ * Find out who's in space JSON library from: * https://github.com/stleary/JSON-java 14 public class Main { 15 public static void main(String[] args) { 16 final String theURLString = "http://api.open-notify.org/astros.json"; 17 Step 1 - read input from above URL and store in a String. Output the String to the console 18 // TODO - 19 // TODO - 20 // TODO - Step 2 - Using the org.json library, 21 // parse the JSON string to determine the number of people in orbit 22 // and then output that value 23 // TODO - Step 3 Parse the JSON object and print the list of people 24 // in orbit and where they are. 25 } 26 Resource - Path Location Type Background Who's in Space The following URL provides information about all the people who are currently in space. http://api.open-notify.org/astros.json Paste the URL into a web browser and examine the JSON data that is returned. Assignment Download the Lab 7 starter project, unzip it with 7-zip and "Extract Here", and import it into Eclipse. You are going to write a program that accesses the above URL's to display the number of people currently in space as well as a detailed list of who is in space and where they are (usually the International Space Station). Write the program in three steps: 1. Write Java code to read input from the supplied URL into a single String. Output the String to verify the program works correctly. 2. Use the supplied org.json library (already included in the starter project) to parse the JSON and determine a count of the number of people in space. Output that value (with appropriate text labeling). 3. Use the supplied org.json library to parse the list of people in space and their location. Output that information. Example Output Note: output may differ from the results below as the list of people in space changes over time. {"message": "success", "number": 10, "people": [{"craft": "ISS", "name": "Sergey Ryzhikov"}, {"craft": "ISS", "name": "Kate Rubins"}, {"craft": "ISS", "name": "Sergey Kud-Sverchkov"}, {"craft": "ISS", "name": "Mike Hopkins"}, {"craft": "ISS", "name": "Victor Glover"}, {"craft": "ISS", "name": "Shannon Walker"}, {"craft": "ISS", "name": "Soichi Noguchi"}, {"craft": "ISS", "name": "Mark Vande Hei"}, {"craft": "ISS", "name": "Oleg Novitskiy"}, {"craft": "ISS", "name": "Pyotr Dubrov"}]} There are 10 people in space Sergey Ryzhikov is onboard: ISS Kate Rubins is onboard: ISS Sergey Kud-Sverchkov is onboard: ISS Mike Hopkins is onboard: ISS Victor Glover is onboard: ISS Shannon Walker is onboard: ISS Soichi Noguchi is onboard: ISS Mark Vande Hei is onboard: ISS Oleg Novitskiy is onboard: ISS Pyotr Dubrov is onboard: ISS Package Explorer X Project Explorer ✓Lab7 src W #edu.cscc V V Main.java Main main(String[]): void module-info.java AstrosSolution > Referenced Libraries > JRE System Library [jdk-11.0.9.11-hotspot] lib json-20210307.jar *module-info.java X 1 module AstrosSolution { requires org.json; 123 3} Problems X @Javadoc Declaration Coverage 12 errors, 9 warnings, 0 others Description *Main.java X 2-import java.io. BufferedReader; 3 import java.io.IOException; 4 import java.io.InputStreamReader; 5 import java.net.MalformedURLException; 6 import java.net. URL; 7 import java.net. URL Connection; 8 import java.util.ArrayList; 9 import org.json. *; 10- /** 11 12 13 */ * Find out who's in space JSON library from: * https://github.com/stleary/JSON-java 14 public class Main { 15 public static void main(String[] args) { 16 final String theURLString = "http://api.open-notify.org/astros.json"; 17 Step 1 - read input from above URL and store in a String. Output the String to the console 18 // TODO - 19 // TODO - 20 // TODO - Step 2 - Using the org.json library, 21 // parse the JSON string to determine the number of people in orbit 22 // and then output that value 23 // TODO - Step 3 Parse the JSON object and print the list of people 24 // in orbit and where they are. 25 } 26 Resource - Path Location Type
Expert Answer:
Answer rating: 100% (QA)
Step 1 Read input from the URL and store it in a String Output the String to the console java import ... View the full answer
Related Book For
Essential Statistics
ISBN: 9780134134406
2nd Edition
Authors: Robert Gould, Colleen N. Ryan, Rebecca Wong
Posted Date:
Students also viewed these programming questions
-
Yash and Syed are good friends. Everyone likes Yash -- he's always friendly and joking around. One day Yash saw Syed walking down the school hallway, so Yash decided to sneak up on him and give him a...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Being employed as a casual barista in a local caf with a flourishing catering business called 'Brown's Caf' , where you are supervised by the caf owner, Jessica Williams. The company employs 20...
-
Following is a list of account titles. Each of the transactions listed below is a cash transaction. Choose the account title that should be used to record the non-cash side of each transaction. The...
-
Do the auditing standards provide explicit guidance for determining the level of evidence provided by ADA used as tests of details?
-
The type of model building used by Pauling and by Watson and Crick involved the use of ball-and-stick units. Model building can now be done with computer software. Even though you may not be familiar...
-
The marketing department at Cleveland Furniture Mfg. has an idea for a new product that is expected to have a 6-year life cycle. After conducting market research, the company found that the product...
-
Calculate inventory amounts when costs are declining During the year, Hooker Incorporated has the following inventory transactions. Date January 1 Transaction Beginning inventory March 4 Purchase...
-
The ADA creates a protected class called "qualified individuals with disabilities". Discuss what this phrase means. How does one qualify for protection. What is the employer's duty to provide a...
-
How should we change the police response to family violence? What laws should be altered? Strengthened? Changed? Should we rely on the law to solve these types of issues knowing that they will most...
-
A-Z Construction Company was organized on May 1 of the current year. On May 2, A-Z Construction prepaid $5,040 to the city for taxes (license fees) for the next 12 months and debited the prepaid...
-
Jackson Inc. produces leather handbags. The production budget for the next four months is: July 5,700 units, August 7,200 units, September 8,300 units, October 8,200 units. Each handbag requires 0.6...
-
A 5 . 0 0 - kg chandelier hangs from the ceiling of an elevator by a cable. The elevator descends through a distance of 1 0 . 0 m in 2 . 0 0 s . At the beginning of this time interval, it is moving...
-
It is an area of law which deals with family matters including marriages, custody and support?
-
Think about your organization. You may define your organization as your place of employment or use another specific organization. If the entire organization seems too large to analyze, you may select...
-
A sprinkler head malfunctions at midfield in an NFL football field. The puddle of water forms a circular pattern around the sprinkler head with a radius in yards that grows as a function of time, in...
-
In the United States, the percentage of adults who own their own home is about 60%. About 90% of U.S. adults own a car. From this information, is it possible to find the percentage of adults who own...
-
A 95% confidence interval for the ages of the first six presidents at their inaugurations is (56.2, 59.5). Either interpret the interval or explain why it should not be interpreted.
-
According to the College Board, the mean quantitative SAT score for male college-bound high school seniors in one year was 530. SAT scores are approximately Normally distributed with a population...
-
Consider a strictly risk averse agent endowed with initial wealth \(w_{0}\) and with a strictly increasing and twice differentiable utility function. Let \(r_{f}\) and \(\tilde{r}\) denote the return...
-
Consider a quadratic utility function \(u(x)=x-\frac{b}{2} x^{2}\), an initial wealth \(w_{0}=100\), a risk free rate \(r_{f}=1.1\) and a risky asset with expected return...
-
Consider the optimal portfolio choice problem in the presence of \(N\) risky assets with returns \(\left(\tilde{r}_{1}, \ldots, \tilde{r}_{N} ight)\) and of a risk free asset with return \(r_{f}>0\)....
Study smarter with the SolutionInn App