Question: public int getNumberOfItemsBought ( String username ) { / / Implement the logic to count the number of items bought by the given user /
public int getNumberOfItemsBoughtString username
Implement the logic to count the number of items bought by the given user
using the ordersService.
i need logic for this aove metthod
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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
