Spring Boot (Coding)

 60 Minutes
 3 Questions

This coding test is designed to assess your knowledge of coding, Spring Boot. You will be asked to complete a series of coding challenges that will test your ability to write code using the Spring Boot framework. The challenges will cover topics such as creating a basic web application, and using the Spring Boot.

Example Question:

You are requested to create a service for the bank in this question.
Given the customer's name and amount of money to deposit or withdraw (by the number sign +/-), you should indicate the success or failure by the following:

If the customer balance doesn't have enough money for the withdrawal, you should return -1 to signal error, otherwise 0.

The current balances are as follows:
  1. BruceWayne -
  2. The current balance is 58$.
  3. ClarkKent -
  4. The current balance is 21$.
  5. DianaPrince -
  6. The current balance is 112$.

Your API should support the following:

Url: UpdateBalance
Method: POST
Request Body (as JSON) :
"customerName": ....,
"amount" : ....

The amount can be positive for a deposit or negative for a withdrawal.
Response: 0 for success, -1 for error.

Url: GetBalance
Method: GET
Parameters: customerName
Response: the customer balance.

*All responses must be strings (not numbers or objects)

For example:
Response: 58
Post to /UpdateBalance:
"customerName": "BruceWayne",
"amount" : 5
Response: 0
Response: 63
Because the balance was updated in the example above
Post to /UpdateBalance:
"customerName": "BruceWayne",
"amount" : -500

Response: -1
Because the balance doesn't have enough money to withdraw 500$.