
In this post, you will get the solution to the first problem of Capgemini ADAPT Sprint 2 – Bus Reservation System JBR-CS5A-L4-1-CRUDOperations.
Note: The solutions are provided for learning purposes only.
Sprint 2 – Problem 3: JBR-CS5A-L4-1-CRUDOperations:
Capgemini ADAPT Problem Description:
Create an interface AdminService. Add CRUD, search methods such as odd, modify, delete, retrieve and search. These methods will be for adding new Admin details, modifying existing Admin Details, deleting Admin details, retrieving Admin details, and searching Admin details respectively.
- Create Admin class as per the given structure with Constructor, setter and getter methods for all the fields.
- Create the Interface as AdminService and include methods for CRUD operation
- and Create the class AdminServiceImpl and implement the AdminService Interface.
- AdminServiceImpl Class should have a static variable adminArray with the size of 5 when the CRUD operation is performed the array should be updated for all the operations.

Sample Input:
AdminService adminService = new AdminServiceImpl();
adminService.createAdmin(rajan);
Admin rajan = new Admin(1004, “[email protected]”, “Rajan”, “Arun”, “Password4”);
rajan.setAdminId(2004);
Sample Output:
Admin[adminId=2004, [email protected], firstName=Rajan, lastName=Arun, password=Password4]
Execution Time Limit:
10 seconds
The solution to JBR-CS5A-L4-1-CRUDOperations:
class Admin{ int AdminId; String emailId; String firstName; String lastName; String pasword; public Admin(){ super(); } public Admin(int AdminId, String emailId, String firstName, String lastName, String password){ super(); this.AdminId = AdminId; this.emailId = emailId; this.firstName = firstName; this.lastName = lastName; this.password = password; } public int getAdminId(){ return this.AdminId; } public void setAdminId(int AdminId){ this.AdminId = AdminId; } public String getemailId(){ return this.emailId; } public void setemailId(String emailId){ this.emailId = emailId; } public String getfirstName(){ return this.firstName; } public void setfirstName(String firstName){ this.firstName = firstName; } public String getlastName(){ return this.lastName; } public void setlastName(String lastName){ this.lastName = lastName; } public String getpassword(){ return this.password; } public void setpassword(String password){ this.password = password; } @Override public String toString(){ return "Admin [adminId="+adminId+", emailId="+emailId+", firstName="+firstName+", lastName="+lastName+", password="+password+"]"; } } interface AdminService{ void createAdmin(Admin admin); Admin updateAdmin(Admin admin); void deleteAdmin(int id); Admin[] getAdmin(); } class AdminServiceImpl implements AdminService{ public static Admin adminArray[] = new Admin[5]; static int count = 0; @Override public void createAdmin(Admin admin) { adminArray[count] = admin; count++; } @Override public Admin updateAdmin(Admin admin) { for(int i = 0; i < adminArray.length; i++) { if(adminArray[i].getAdminId() == admin.getAdminId(){ adminArray[i] = admin; return admin; } } return admin; } @Override public void deleteAdmin(int AdminId) { for(int i = 0; i < adminArray.length; i++) { if(adminArray[i].getAdminId() == AdminId) { adminArray[i] = null; } } } @Override public Admin[] getAdmin(){ return adminArray; } } public class Source{ public static void main(String args[]){ AdminService adminService = new AdminServiceImpl(); Admin rajan = new Admin(1004, "[email protected]", "Rajan", "Arun", "Password4"); adminService.createAdmin(rajan); System.out.println(rajan); } }
TOP COMPANIES HIRING DRIVE |
BATCHWISE OFF-CAMPUS DRIVES |
1. TCS OFF-CAMPUS DRIVES | 1. 2018 BATCH |
2. INFOSYS OFF-CAMPUS DRIVES | 2. 2019 BATCH |
3. COGNIZANT OFF-CAMPUS DRIVES | 3. 2020 BATCH |
4. WIPRO OFF-CAMPUS DRIVES | 4. 2021 BATCH |
5. CAPGEMINI OFF-CAMPUS DRIVES | 5. 2022 BATCH |
To Stay Up-to-date, Follow us on Social Media:
1. Join our Telegram Channel: |
Click Here |
2. Like us on Facebook: |
Click Here |
3. Follow us on Instagram: |
Click Here |
4. Follow us on LinkedIn: |
Click Here |
5. Follow us on Google News: |
Click Here |
Capgemini ADAPT Sprint 1 (Bus Reservation Solutions):
- 1. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerInAscendingOrder Problem Solution
- 2. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerByFirstName Problem Solution
- 3. Capgemini ADAPT Sprint 1 Bus Reservation System – SortByCustomerId Problem Solution
- 4. Capgemini ADAPT Sprint 1 Solution Java | LSAByCustomerName Problem Solution
- 5. Capgemini ADAPT Sprint 1 Case Study Solution Java | BSAByCustomerId Problem Solution
Capgemini ADAPT Sprint 2 (Bus Reservation System):
- 1. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution | HAS-A-Relationship Solution Java
- 2. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution OOPs-Para-Constructor Java
- 3. Capgemini ADAPT Sprint 2 Bus Reservation System (CRUDOperations) Problem Solution
Study Materials for Interview Preparation (FREE MATERIALS):
- 240 Core Java Questions & Answers with PDF Download Link – Click Here
- 230+ SQL interview questions & answers pdf download – Click Here
- 50 LeetCode Interview Questions with Answers – PDF Notes – Click Here