Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The application will ask how many groups are desired. User input is bolded. Enter the number of groups: 3 When a valid integer is entered,

The application will ask how many groups are desired. User input is bolded. Enter the number of groups: 3 When a valid integer is entered, the application will ask the user to enter a student name. Enter the student name: Trudy Weigel Assume that whatever the user types until they hit the enter key is a valid name. Keep entering names until an x is entered. Here's a sample: Enter number of groups: 3 Enter the student name (or x to exit): Fred Enter the student name (or x to exit): Barney Enter the student name (or x to exit): Wilma Enter the student name (or x to exit): Betty Enter the student name (or x to exit): Bam Bam Enter the student name (or x to exit): Pebbles Enter the student name (or x to exit): Dino Enter the student name (or x to exit): x The x concludes the list of student names. Once the user has entered all of the names, the application will process the information and output the groups. Students should be randomly assigned to groups. (The shuffle method is very useful here!) The number of students per group should be maximized; however, it is possible that some groups will have one more student in the group than other groups. No student can be in more than one group. No student should be left out; every student should be in one group. For example, I may ask for 3 groups from 11 students (that are entered from the console). The students names may be: Trudy Weigel Jim Dangle Jonesy Raineesha Williams Clementine Johnson Junior James Garcia C. Kimball Frank Rizzo Jack Declan Mayor Hernandez Your output must be formatted as below. The 3 groups might be: Group #1 Jack Declan Jim Dangle Mayor Hernandez Raineesha Williams Maggie Group #2 C. Kimball Trudy Weigel Clementine Johnson Junior Krusty Apu Group #3 Jonesy Frank Rizzo James Garcia You must use the Java classes ArrayList and Random to implement. In fact, you must use an ArrayList of ArrayLists. Also, all of the logic may not be contained in the main program. You must find a way to reuse code in this exercise. Therefore, the definition of another class is required with: 1. a constructor 2. at least one instance variable 3. at least one method that returns a value Name the program that contains the main method RandomGroupGenerator.java

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 8th International Symposium Sstd 2003 Santorini Island Greece July 2003 Proceedings Lncs 2750

Authors: Thanasis Hadzilacos ,Yannis Manolopoulos ,John F. Roddick ,Yannis Theodoridis

2003rd Edition

3540405356, 978-3540405351

More Books

Students also viewed these Databases questions

Question

In Problems 1316, find each sum. 10 (-2)* k=1

Answered: 1 week ago

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago