- Fork this repo.
- Clone your fork to your local machine.
- Solve the challenges.
- Upon completion, add your solution to git.
- Then commit to git and push to your repo on GitHub.
- Make a pull request and paste the pull request link in the submission field in the Student Portal.
-
Create a Spring Boot application using Spring Initializr with the following dependencies:
- Spring Web
- Spring Boot DevTools
-
Create a
GreetingControllerclass that has the following endpoints:/hello- Returns "Hello World!"/hello/{name}- Returns "Hello {name}!" where {name} is a path variable/add/{num1}/{num2}- Returns the sum of num1 and num2/multiply/{num1}/{num2}- Returns the product of num1 and num2
-
Create a
WeatherServiceclass that has methods to:- Get current temperature (simulate with random number between -10 and 40)
- Get weather condition (randomly return: "Sunny", "Rainy", "Cloudy", "Windy")
- Get wind speed (simulate with random number between 0 and 100)
-
Create a
WeatherControllerclass that uses constructor injection to receive theWeatherServiceand has endpoints to:/weather/temperature- Returns current temperature/weather/condition- Returns current weather condition/weather/wind- Returns current wind speed/weather/all- Returns all weather information in a single response
-
Create a
TimeServiceclass that has methods to:- Get current time
- Get current date
- Get current day of the week
-
Create a
TimeControllerclass that uses constructor injection to receive theTimeServiceand has endpoints to:/time- Returns current time/date- Returns current date/day- Returns current day of the week/all- Returns all time information in a single response
Remember:
- Use proper package structure
- Use constructor injection instead of @Autowired
- Test all endpoints using your web browser or Postman
- Include appropriate error handling
- Use meaningful variable and method names
