10) Write a complete Java program that prompts the user to create a list of the following types: String, Integer and Double. Your program should create the appropriate list type as determined by the user.

What will be an ideal response?


```
import java.util.*;

public class FunWithLists
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int listChoice;
ArrayList list;
String listElement;

//Display a list of list choices for the user
System.out.println("Enter the number of the list you wish to create:");
System.out.println(" 1. String");
System.out.println(" 2. Integer");
System.out.println(" 3. Double\n\n");

listChoice = sc.nextInt();

switch(listChoice)
{
case 1:
list = new ArrayList(100);
break;
case 2:
list = new ArrayList(100);
break;
case 3:
list = new ArrayList(100);
break;
default:
System.out.println("Invalid choice");
break;
}

}

}

```

Computer Science & Information Technology

You might also like to view...

What clause of the ISO 12207 standard outlines the measurement process?

A. 6.3.4 B. 6.3.5 C. 6.3.6 D. 6.3.7

Computer Science & Information Technology

A JAD session involves:

A) casual planning, since the interaction between users is when the activity occurs in a creative fashion. B) using a session leader that has excellent communication skills. C) having a systems analyst as a session leader. D) note-taking by all the individuals within the session.

Computer Science & Information Technology

____ solve the problem of overlapping shapes without merging them.

a. Stacks b. Fills c. Layers d. Clusters

Computer Science & Information Technology

What are abstract methods? Describe the circumstances in which an abstract method would be appropriate.

What will be an ideal response?

Computer Science & Information Technology