Question: Toggle Sidebar New Agent Hotel Double Cross Akshay words for the Socret Intelligent Servics His role involves decoding cryptic information Recently he has received 3

Toggle Sidebar
New
Agent
Hotel Double Cross Akshay words for the Socret Intelligent Servics His role involves decoding cryptic information Recently he has received 3 sets of numbers ( arrays of numbers). The number of elements in vach set in each array) is the same. These numbers have to be decoded to find the room number of a person staying in Hotel Double Cross. The below example demonstrates the steps to be performed while decoding the given numbers
Example - Let us assume that the 3 set of numbers are as below
input1(1,2,3,4)
input2(2345)
input3(1.3.5.7
Step 1: Generate a new set of elements by adding numbers present at the same index in the three
armays. So, we get, (4,112,16) Step 2. The array generated in step 1 represents the position of the elements in the three arrays
Le
the first number 4 represents the number in 4th position in the FIRST array
the second number 8 represents the number in 8th position in the SECOND array. the third number 12 represents the number in 12th position in the THIRD array.
the fourth number 16 represents the number in 16th position in the FIRST array.
In STEP2, our task is to pick the numbers from these specified positions from the respective
arrays. Le.
Number at 4th position in the FIRST array is 4
Number at 8th position in the SECOND array is 5(Note that the array contains only 4 elements, so the 8th position can be found by counting the positions in cyclic manner, ie, after reaching last element of the array, continue counting from the first element of the array. This way the number in the 8th position in the second array is 5)
Number at 12th position in the THIRD array is 7(apply same counting logic as above) Number at 16th position in the FIRST array is 4(apply same counting logic as above)
So, we get the positional numbers as (4,5,7,4)
Step 3: Add ALL the positional numbers generated in step 2 to get the FINAL Result which represents the room number in Hotel Double Cross. i.e. Room number =4+5+7+420
Note:
There will always be THREE input arrays
All 3 arrays will have the same number of elements
The number of array elements is specified by input4
The array elements will always be positive numbers greater than 0 Note:
There will always be THREE input arrays
All 3 arrays will have the same number of elements
The number of array elements is specified by input4
The array elements will always be positive numbers greater than 0
input1(10,33,5,40,120,98,1) input2(121,78,21,32,91,340,72)
Example 2: Let us now assume the 3 input arrays are as given below:
input3(65,320,72,84,32,843,40) input47(the number of elements in each of the input arrays)
Step1: The new set of elements by adding numbers present at the same index in the three arrays will be (196,431,98,156,243,1281,113)
1(number present at position 196 in input1)
Step2: Picking up numbers from input1, input2 and input3 based on the output of Step1 we get:
32(number present at position 431 in input2)
40(number present at position 98 in input3)
33(number present at position 156 in input1)
91(number present at position 243 in input2)
40(number present at position 1281 in input3)
10(number present at position 113 in input1)
Step3: Sum of these numbers gives the Room Number: 247
Author: Pranam Kaushik
Here is the incomplete Java code please give total code:
import java.io.*;
import java.util.*;
// Read only region start
class UserMainCode
{
public int findRoomNo(int input1, int input2, int input3, int input4){
// Read only region end
10
// Write code here...
11
12
}
13
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!