Answer to Question #254854 in Java | JSP | JSF for Shwetha T P

Question #254854
While using a computer, a user uses the ALT TAB key to sch between applications. The ALT-TAB window works on the principle of holding the ALT key for MRU listing.Hence the applications arrange themselves in such a way that the most Recently used application will be the first item in the ALT TAB window and so forth. You are given the list of opened applications and the number of the that the user presses the Tab key switch between applicate the final arrangement of application in the ALT-TAB window Example In the given picture, Libraries application in focused which means that holding the ALT key,the user presses the Tab key twice internet.Explore being the most recently used application followed by libraries and so on. Output specification input1: An array representing the percentage of numbers in each city Input2: Number of cities in the country Output Specification: Return the favorable city index'i'. Example 1: input1: {1,1,3,6,7,3} input2: 6 Output: 4 Please give the java coding solution for this question
1
Expert's answer
2021-10-22T00:48:58-0400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] array = new int[6];
        int max = 0;
        for (int i = 0; i < array.length; i++) {
            array[i] = in.nextInt();
            if (array[max] < array[i]) {
                max = i;
            }
        }
        int cities = in.nextInt();
        System.out.println(max);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS