Reference no: EM133422752
Building RESTful Web Services for Fibonacci Sequence Operations Using Spring
Preface
The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding numbers. The sequence starts with 0 and 1, and each subsequent number is the sum of the two previous numbers. The sequence continues infinitely and goes as follows: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, and so on. The sequence is named after Leonardo Fibonacci, an Italian mathematician who introduced the sequence to the Western world in his book Liber Abaci, which was published in 1202. The Fibonacci sequence has many interesting mathematical properties and has been observed in various natural phenomena, such as the branching of trees and the spirals in shells.
Question
In this assignment, you will be building a set of RESTful web services using Spring that will allow clients to perform several operations related to the Fibonacci sequence. The web services will be able to generate the Fibonacci sequence up to a specified number, generate the nth number in the sequence, calculate the sum of the first 6 numbers in the sequence, and check if a given number is a member of the sequence.
Technical Tasks to do:
1. Start by creating a new Spring project in Spring Tool Suite (STS) or your preferred IDE, and then define suitable classes to handle the web service requests.
2. Implement the genFibonacci(n) web service to generate the Fibonacci sequence up to a specified number 'n' provided by the user in the URL. This should be done using a loop that generates each number in the sequence until the number exceeds the specified limit. A valid URL can be in the form of
localhost:8080/assignment2/services/fiborestservice/genfibonacci/n
where 'n' is an integer that satisfies 0 ≤ n < 100.
3. Implement the genFibo(n) web service to generate the nth number in the Fibonacci sequence, where n is a number provided by the user in the URL. This should be done using a loop that generates each number in the sequence until it reaches the nth number. A valid URL can be in the form of
localhost:8080/assignment2/services/fiborestservice/genfibo/n
where 'n' is an integer that satisfies 10 ≤ n ≤ 20.
pg. 2
4. Implement the calcFib6Sum web service to calculate the sum of the first 6 numbers in the Fibonacci sequence. This should be done using a loop that generates each number in the sequence and adds it to a running total until it reaches the 6th number. A valid URL can be in the form of
localhost:8080/assignment2/services/fiborestservice/calcfib6Sum
5. Implement the chkFib(n) web service to check if a given number 'n' is a member of the Fibonacci sequence. This should be done by generating each number in the sequence until the number is greater than n, and then checking if the last generated number in the sequence is equal to the given number. A valid URL can be in the form of
localhost:8080/assignment2/services/fiborestservice/chkfib/n
where 'n' is a non-negative integer excluding zero.
6. Ensure that the web services can produce and consume JSON objects.
7. Handle invalid data exceptions by using appropriate exception handlers in Spring. This should be done for all the web services where invalid input data exception handling makes sense.
8. Enrich the security of the web service by adding Basic Authentication. This will require clients to authenticate themselves using a username and password before they can access the web service.
9. Test all the developed endpoints in Postman to ensure that they function as expected.
What is a concentration gradient
: What is a concentration gradient? Define the terms hypotonic, isotonic, and hypertonic. Explain the direction of the solute and the solvent in each case.
|
Select a phylum from lophotrochozoa and discuss
: Select a phylum from Lophotrochozoa and discuss. Name three classes of the Arthropoda and their characteristics (give an example per group).
|
Discuss the thermoregulatory risks of exercise
: Discuss the thermoregulatory risks of exercise that are exacerbated by advancing age. Why are older people more prone to these issues?
|
Estimate how many parking spaces should be provided
: Estimate approximately how many parking spaces should be provided at the garage. Justify your reasoning, possibly with reference to some queueing theory model
|
Define suitable classes to handle the web service requests
: Start by creating a new Spring project in Spring Tool Suite (STS) or your preferred IDE, and then define suitable classes to handle the web service requests
|
What is sarcopenia
: Sarcopenia is one of the early signs of frailty. What is sarcopenia? Loss of muscle mass Loss of cognitive ability Bone weakness Difficulty
|
What are some of the reasons for the fall of tenochtitlan
: Who, what, where, when, and how: What are some of the reasons for the Fall of Tenochtitlan? Please be specific and explain these reasons.
|
Describe how to isolate, identify and culture a stem cell
: Describe how to isolate, identify and culture a stem cell type, focusing on the protocol and culture conditions in 10-15 steps/bullet points.
|
What is the phenotype and genotype ratios that result
: What is the phenotype and genotype ratios that result if you cross a white mouse with a gray mouse?
|