Respuesta :

ijeggs

Answer:

import java.util.ArrayList;

import java.util.Scanner;

import java.util.Collections;

public class num6 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int num;

       ArrayList<Integer> al=new ArrayList<Integer>();

       do{

           System.out.println("Enter a series of integers. To quit enter -1");

           num = in.nextInt();

           al.add(num);

       }while(num>=0);

       System.out.println( "The minimum Value: " + Collections.min(al) );

       System.out.println( "The Maximum Value: " + Collections.max(al) );

   }

}

Explanation:

  1. Create an ArrayList Object
  2. Prompt user to continually enter integer values (while numbers is >=0)
  3. Store the values in the ArrayList
  4. Use the Collections.min Method to print the smallest value
  5. Use Collections.max Method to print the largest value