# Capgemini ADAPT 2022 Online Shopping A – Search Customers by City Solution using JAVA

In this post, we will try to give a solution to an important problem of Capgemini ADAPT 2022. The problem is Online Shopping A – JOSL-S3-L2-3-Search Customers By City.

However, the solutions are provided for learning purposes only. Candidates must submit their own code during attending the Sprints.

### Online Shopping A – JOSL-S3-L2-3-Search Customers By City Solution:

public class Source {
String customerDetails[][]=new String[5][3];
Source()
{
customerDetails[0][0]=”1001″;
customerDetails[0][1]=”Raj”;
customerDetails[0][2]=”Chennai”;
customerDetails[1][0]=”1008″;
customerDetails[1][1]=”Akshay”;
customerDetails[1][2]=”Pune”;
customerDetails[2][0]=”1002″;
customerDetails[2][1]=”Simrath”;
customerDetails[2][2]=”Amristar”;
customerDetails[3][0]=”1204″;
customerDetails[3][1]=”Gaurav”;
customerDetails[3][2]=”Delhi”;
customerDetails[4][0]=”1005″;
customerDetails[4][1]=”Ganesh”;
customerDetails[4][2]=”Chennai”;
}
void binarySearch(String arr[][],int f,int l,String x){
int mid=(f+l)/2;
while(f<=l){
if(arr[mid][2].compareTo(x)<0){
f=mid+1;

}else if(arr[mid][2].equals(x)){
int temp=mid;
int temps=mid;
if((temps-1>=f) && arr[temps-1][2].equals(x)){
temps=temps-1;
while(arr[temps][2].equals(x)){
System.out.println(arr[temps][0]+”\n”+arr[temps][1]+”\n”+a
rr[temps][2]);
if(temps-1>=f)
temps=temps-1;
}
}
System.out.println(arr[temp][0]+”\n”+arr[temp][1]+”\n”+arr
[temp][2]);
if(temps+1<=l && arr[temp+1].equals(x)){
temp=temp+1;
while(arr[temp][2].equals(x)){
System.out.println(arr[temp][0]+”\n”+arr[temp][1]+”\n”+arr
[temp][2]);
temp=temp+1;
}
}
break;
}
else{
l=mid-1;
}
mid=(f+l)/2;
}
if(f>l){
System.out.println(“No Record Found”);
}
}
public static void main(String args[] ) throws Exception {
/* Enter your code here. Read input from STDIN. Print output to
STDOUT */
Source ob=new Source();
Scanner sc=new Scanner(System.in);
String c=sc.nextLine();
Arrays.sort(ob.customerDetails,Comparator.comparing(arr->arr[2]));
ob.binarySearch(ob.customerDetails,0,4,c);
sc.close();
}

}

Note: We could not get the problem statement yet. If you have the problem statement you can send us at – [email protected]. We will try to update the answers according to the problem statement.

### Top Companies + Batchwise Hiring Drive:

 TOP COMPANIES HIRING DRIVE BATCHWISE HIRING DRIVES

### 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

### Online Shopping A Solutions Using Java:

• 1. Capgemini ADAPT 2022 Online Shopping A – Display Products Solution using JAVA – Click Here
• 2. Capgemini ADAPT 2022 Online Shopping A – Products by Category Solution using JAVA – Click Here
• 3. Capgemini ADAPT 2022 Online Shopping A – Customer Array Solution using JAVA – Click Here
• 4. Capgemini ADAPT 2022 Online Shopping A – Search Customers by Name Solution using JAVA – Click Here

Job Seeker 24 provides Off-Campus Drive Updates, Engineering Job Updates, IT Job Updates, Jobs for Freshers, Private Sector Jobs, Public Sector Jobs, various Educational Opportunities, etc.