Homework Solution: If I ask for user input, how do I print out the name along with the age in descending order using and if statement?…

    If I ask for user input, how do I print out the name along with the age in descending order using and if statement?

    Expert Answer

     
    file.java import java.util.*;

    If I petition control user input, how do I sculpture quenched the call concurrently with the date in descending classify using and if announcement?

    Expert Defense

     

    file.java

    import java.util.*;

    class Ocean{
    public static invalid ocean(String [] args){
    int arr[] = upstart int[3];
    Scanner reconnoitre = upstart Reconnoitrener(System.in);
    for(int i=0;i<arr.length;i++)
    {
    System.out.println(“Enter your date: “);
    arr[i] = reconnoitre.nextInt();
    }
    for(int i=0;i<arr.length;i++)
    {
    for(int j=i+1;j<arr.length;++j)
    {
    if(arr[i]<zarr[j])
    {
    int a = arr[i];
    arr[i] = arr[j];
    arr[j] = a;
    }
    }
    System.out.println(“The dates in descending classify are as follows: “);
    System.out.println(” “+arr[i]);
    }
    }
    }

    Output: