In this post, we will try to give a solution to an important problem of Capgemini ADAPT 2022. The solution to the Problem is – Repeated Salary Count Problem Solution using Java.

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

### Repeated Salary Count Problem Description – Capgemini ADAPT:

Jas is working as a clerk in an organization where N number of people are working. His boss has asked him to get the count of employees who get the same salary. Help him to get the count of repeated salary.

Include a method named countRepeaters that accepts 2 arguments and returns an int. The first argument is the input array and the second argument is an int that corresponds to the size of the array. The method returns an int that corresponds to the number of repeaters.

#### Input & Output Format:

Input consists of n+1 integers. The first integer corresponds to n, the number of elements in the array. The next ‘n’ integers correspond to the elements in the array.

The output consists of an integer that corresponds to the number of repeaters.

Assume that utmost one element in the array would repeat.

Assume that the maximum number of elements in the array is 20.

### Repeated Salary Count Problem Solution:

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Source{
public static void main(String[] args){
int n, i, j, k, count = 1;
Scanner in = new Scanner(System.in);
n = in.nextInt();
if(n<0){
System.out.println(“Invalid Input”);
System.exit(0);
}
else{
int a[] = new int[100];
for(i = 0; i < n; i++){
a[i] = in.nextInt();
if(a[i] < 0){
System.out.print(“Invalid Input”);
System.exit(0);
}
}
for(i = 0; i < n; i++){
for(j = i+1; j < n;){
if(a[i] == a[j]){
count++;
for(k = j; k < n; k++)
a[k] = a[k+1];
n–;
}
else
j++;
}
}
System.out.print(count);
}
}
}

### Top Companies + Batchwise Hiring Drive:

 TOP COMPANIES HIRING DRIVE BATCHWISE HIRING 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

### 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
• 5. Capgemini ADAPT 2022 Online Shopping A – Search Customers by City Solution using JAVA – Click Here