0

Code error

import java.util.Arrays; import java.util.Scanner ; public class Program { public static void main(String[] args) { Scanner input= new Scanner(System .in); String MyName=input.nextLine(); int number_of_agent=input.nextInt(); String[] other_customary=(input.nextLine()).split(" "); int turn=1; Arrays.sort(other_customary); for(int x=0;x<4;x++){ if( MyName.compareTo(other_customary[x])==-1){ turn+=x; break; } } if(MyName.compareTo(other_customary[3])==1){ turn=5; } int devide=turn/number_of_agent; int modulus=turn%number_of_agent; if(modulus==0){ System.out.print((devide)*20); } else{ System.out.print((devide+1)*20); } } } I dont know what is problem in my code.i am solving "new driver's license" question in sololearn.

26th Dec 2020, 9:11 PM
Mohammad Reza Moravejolahkami
Mohammad Reza Moravejolahkami - avatar
1 ответ