/*Proctored Assessment 13 Feb'2020
Question 1:
Take a String as input and print the vowel with least ascii value in the String
test cases:
Input: matrix
Output: a
*/
import java.util.Scanner;
public class Solution1
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String s=sc.next();
int min=1000;
for (int i=0;i<s.length();i++)
{
char ch=s.charAt(i);
if((int)ch<min && (ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' ))
{
min=(int)ch;
}
}
System.out.println((char)min);
}
}
/*Proctored Assessment 13 Feb'2020
Question 2:
Create a class Sim with following attributes
int simId;
String customerName;
String circle;
double balance;
double ratePersecond
create Another public class Solution make and take input for 5 object(EACH HAVING 5 ATTRIBUTES) and take 2 String for Current circle and updated value for the circle
select only those object having circle same as string1 and update these circle value to string 2. After this sort the object array in descending order of ratePersecond and print the corresponding SimId, customername, circle, ratePersecond for each object
Test Cases:
Input:
1
anuj
AHM
1000
1.8
2
anany
MUM
2000
1.5
3
anubhav
AHM
3000
2.8
4
prajjwal
MUM
700
1.6
5
anshika
MUM
900
3
MUM
AHM
OUTPUT:
5 anshika AHM 3.0
4 prajjwal AHM 1.6
2 anany AHM 1.5
*/
import java.util.*;
class Solution2
{
public static void main(String args[])
{
Sim s1=new Sim();
Sim s2=new Sim();
Sim s3=new Sim();
Sim s4=new Sim();
Sim s5=new Sim();
Sim s[]={s1,s2,s3,s4,s5};
Scanner sc=new Scanner(System.in);
for (int i=0;i<5;i++)
{
s[i].simId=sc.nextInt();
s[i].customerName=sc.next();
s[i].circle=sc.next();
s[i].balance=sc.nextDouble();
s[i].ratePersecond=sc.nextDouble();
}
String c1=sc.next();
String c2=sc.next();
int count=0;
for (int i=0;i<s.length;i++)
{
if(s[i].circle.equals(c1))
{
count++;
}
}
int c=0;
Sim s11[]=new Sim[count];
for (int i=0;i<s.length;i++)
{
if(s[i].circle.equals(c1))
{
s11[c]=s[i];
c++;
}
}
double a[]=new double[count];
for (int i=0;i<s11.length;i++)
{
a[i]=s11[i].ratePersecond;
}
Arrays.sort(a);
for (int i=a.length-1;i>=0;i--)
{
for (int j=0;j<s11.length;j++)
{
if(a[i]==s11[j].ratePersecond)
{
System.out.println(s11[j].simId+" "+s11[j].customerName+" "+c2+" "+s11[j].ratePersecond);
}
}
}
}
}
class Sim
{
int simId;
String customerName;
String circle;
double balance;
double ratePersecond;
}
Commentaires