 Highest Feedback Problem Solution in Java | Capgemini ADAPT 2022 Solution using Java

In this post, you will get the solution to the Capgemini ADAPT 2022 solution to the problem of Highest Feedback in Java. Capgemini ADAPT Java Solutions 2022, Highest Feedback.

Note: The solutions are provided for learning purposes only.

## Highest Feedback Problem Description:

In a company, there are some managers working on two different projects(MetLife and Hardfort). When the feedback was taken their feedback was present in both MetLife Feedback as well as Hardfort Feedback. Write a method to create consolidated feedback for the managers for MetLife and HardForts. For those working on both projects, the highest feedback is taken. In the 2 given arrays, the First index represents the Employee id and the second one Represents the Feed BAck Score, and so on…

#### Input and Output Format (Highest Feedback):

First-line corresponds to n, the size of the array. The next n lines correspond to the elements of the first array. The next n lines correspond to the elements in the second array. The output corresponds to the consolidated feedback score.

## Capgemini ADAPT 2022 – Highest Feedback Problem Solution in Java:

import java.util.Scanner;
public class Source
{
public static void main(String[] args)
{
int n, i,j,k=0,count,count1;
Scanner in=new Scanner(System.in);
n = in.nextInt();
if(n < 0)
{
System.out.print(“Invalid array size”);
System.exit(0);
}
else
{
int a[]=new int[n];
for(i = 0; i< n; i++)
{
a[i] = in.nextInt();
if(a[i] < 0)
{
System.out.print(“Invalid input”);
System.exit(0);
}
}
int b[]=new int[n];
for(i = 0; i< n; i++)
{
b[i] = in.nextInt();
if(b[i] < 0)
{
System.out.print(“Invalid input”);
System.exit(0);
}
}
int c[]=new int;
for(i=0;i<n;i=i+2)
{
count=0;
for(j=0;j<n;j=j+2)
{
if(a[i]==b[j])
{
count=1;
if(a[i+1]>b[j+1])
{
c[k]=a[i];
c[++k]=a[i+1];
k++;
}
else
{
c[k]=a[i];
c[++k]=b[j+1];
k++;
}
}
}
if(count==0)
{
c[k]=a[i];
c[++k]=a[i+1];
k++;
}
}
for(i=0;i<n;i=i+2)
{
count1=0;
for(j=0;j<n;j=j+2)
{
if(b[i]==a[j])
{
count1=1;
}
}
if(count1!=1)
{
c[k]=b[i];
c[++k]=b[i+1];
k++;
}
}
for(i=0;i<k;i++)
{
System.out.println(c[i]);
}
}
}
}

### BATCHWISE OFF-CAMPUS DRIVES

1. TCS OFF-CAMPUS DRIVES1. 2018 BATCH
2. INFOSYS OFF-CAMPUS DRIVES2. 2019 BATCH
3. COGNIZANT OFF-CAMPUS DRIVES3. 2020 BATCH
4. WIPRO OFF-CAMPUS DRIVES4. 2021 BATCH
5. CAPGEMINI OFF-CAMPUS DRIVES5. 2022 BATCH

## ADAPT Different Coding Solutions:

1. Largest Array Solution – Click Here
2. Batsman & Bowler Solution – Click Here
3. Instruments Problem Solution – Click Here
4. Check Two Person Are Same – Click Here
7. Remove”X”inString Problem Solution – Click Here
8. Customer and Invoice ADAPT Problem Solution – Click Here
9. Book and Author Problem Solution – Click Here
10. Highest Feedback Problem Solution – Click Here