Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task 1 You are writing an endpoint that returns the total number of items bought in your online store by a given user. Orders in
Task
You are writing an endpoint that returns the total number of items bought in your online store by a given user.
Orders in your system are stored in an external service called
OrdersService Your task is to:
write an endpoint in the given UsersController rass;
write a method in the given UsersService class that counts the number of items bought by the given user;
configure the UsersController and UsersService classes.
Solving this task requires from you editing the following three files. Please make sure they are all present in your final solution.
com.codility. app. AppConfiguration
com.codility. app. UsersController
com.codility. app. UsersService
Interfaces
The UsersService class declares:
a field ordersService : private ordersService ordersService
a method getNumberofItemsBought : public int getNumberfItemsBought String username
The Uselscontroller class declares:
a field usersservice private UsersService usersService
a method totalt temaBought in public Man
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