Question
Getting Started In IntelliJ, create a new Gradle project from scratch and set up thebuild.gradlefile. The Problem:You will be using the Numbers API for concurrently
Getting Started
In IntelliJ, create a new Gradle project from scratch and set up thebuild.gradlefile.
The Problem:You will be using the Numbers API for concurrently retrieving random facts about numbersbetween 0 and 250.
Functional Requirements:
All of your code must be object-oriented and organized into packages based on functionality.
You should have a class that contains only themainmethod and that method should onlycontain 4-5 lines of code (for running the code)
.You should avoid loops and use streams/lambdas.
Generate 50 random integers and save these random integers to a list-like data structure(array, list, etc). (Hint: check out the docs for the Random class and see if there is somethingwith streams that might help you).
Print out these integers to the console, all on the same line separated by spaces, in the orderin which they occur in the data structure.
Then, using theExecutorsfactory class and fixed thread pool, create 50 asynchronous callsto the Numbers API (url provided below).
You should be able to get the results asynchronously - i.e. the results for each number shouldnot be stored/returned in the same order as the numbers in the data structure. Specifically,you need to be able to show that the code is asynchronous.
The results from calling the Numbers API should be printed out to the console. These resultsshould not be JSON - they should instead be parsed to be single strings
.The Numbers API is http://numbersapi.com/
To get the result for a particular number, for example 42, the url API usage would be http://numbersapi.com/42
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