Capgemini ADAPT Sprint 1 Bus Reservation System - DisplayCustomerInAscendingOrder Problem Solution
Capgemini ADAPT Sprint 1 Bus Reservation System - DisplayCustomerInAscendingOrder Problem Solution

In this post, you will get the solution to the first problem of Capgemini ADAPT Sprint 1 – JBR-CS5A-L1-1-DisplayCustomerInAscendingOrder.

Note: The solutions are provided for learning purposes only. 

Sprint 1 – Problem 1: JBR-CS5A-L1-1-DisplayCustomerInAscendingOrder


Problem Description:


Create a program to accept the five customer’s IDs (alpha-numeric) in an array and display the customer in an ascending Order of IDs.

Sample Input:


1234

5432

8765

2345

4788

Sample Output:


1234

2345

4788

5432

8765

Execution Time Limit:


10 seconds

Solution to JBR-CS5A-L1-1-DisplayCustomerInAscendingOrder:


 

import java.util.*;

public class Source{

public static void main(String args[]) throws Exception{

String arr[] = new String[5];

Scanner sc = new Scanner(System.in);

for(int i = 0; i < 5; i++)

{

arr[i] = sc.nextLine();

}

Arrays.sort(arr);

for(String s:arr){

System.out.println(s);

}

}

}