/**
 * @(#)List2.java
 *
 *
 * @author
 * @version 1.00 2010/8/26
 */

import java.util.*;
public class List2 {

    private int [] arr;
        private final int MAX = 10;

    public List2() {
        //allocate memory to arr
        arr = new int[MAX];
    }
  //accept 10 numbers 
    public void accept(){
        Scanner console = new Scanner(System.in);
        for(int i = 0; i < arr.length;i++)
            arr[i] = console.nextInt();   
        }
    public int smallest(){
     int smallest=0;
     for(int i=0;i<arr.length;i++)
     smallest=Math.min(smallest,arr[i]);
     return smallest;
     }

    public int largest(){
     int largest=0;
     for(int i=0;i<arr.length;i++)
     largest=Math.max(largest,arr[i]);
     return largest;
     }
    public int sum(){
        //declare local variable sum
        int sum = 0;
        for(int i = 0; i < arr.length;i++)
            sum+= arr[i];
        return sum;
        }
    public void display(){
        for(int i = 0; i < arr.length; i++)
            System.out.print(arr[i] + " ");
        System.out.println();//newline
        }
    //main
    public static void main(String [] args){
        List2 list1 = new List2();
        List2 list2 = new List2();
            //accept 10 numbers for list1 object
         System.out.println("enter numbers for list1:");
            list1.accept();
            //display values of list1
        System.out.println("values of list1:");
            // display of list1 the smallest and largest
          System.out.println("Smallest value of list1="+list1.smallest());
          System.out.println("Largest vaule of list1="+list1.largest());


            list1.display();
            //display the sum of the value of list1
            System.out.println("sum of the values of list1 = " + list1.sum());

             System.out.println("enter numbers for list2:");
              list2.accept();
            //display values of list1
               System.out.println("values of list2:");
                    // display of list the smallest and largest
                    System.out.println("Smallest value of list2="+list2.smallest());
                    System.out.println("Largest value of list2="+list2.largest());

                list2.display();
            //display the sum of the value of list2
            System.out.println("sum of the values of list2 = " + list2.sum());   
        }

}

can you help how to make a menu into this program switch style
MENU
[1]=ACCEPT;
[2]=DISPLAY SMALLEST;
[3]=DISPLAY LARGEST;
[4]=DISPLAY SUM;
[5]=DISPLAY ALL;
[6]=QUIT;
please help me to figure it out this program
thanks.....

how to make a menu into this program switch style

Not sure what you are asking as the solution is so simple:
Use println() for each line that you want printed:
System.out.println("MENU");
System.out.println("[1]=ACCEPT;");

etc for the rest of the list

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.