Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A professional wedding planner needs some software to help manage seating arrangements for post-wedding dinners. For a wedding with n guests, and tables of size

A professional wedding planner needs some software to help manage seating arrangements for post-wedding dinners.

For a wedding with n guests, and tables of size m, the application needs to assign seating so that there are at most m guests at a table, but not less than m-1 guests at any table.

The seating should be optimal, which we take to mean as: If there is more than one possible seating, the solution that fills the maximum number of tables is optimal.

There are some combinations of m and n for which no solution is possible.

In those situations where no solution is possible, the wedding planner will assign seating manually.

The program will prompt the user and take input from System.in. It should work like this :

How many guests will each table hold? 8

How many guests will be attending the wedding? 63

With 63 guests and a maximum of 8 guests per table, the optimal seating arrangement should have 7 tables of 8 guests, and 1 tables of 7 guests.

If there is no way to get an optimal seating arrangement, the program should print out an informational message and halt. The program should work for wedding sizes of 20 to 500 guests, and table sizes from 4 to 25.

The names of the guests for a 500 person wedding are in a file named 500names.txt. The program will read as many names as required from the beginning of the file, or n lines.

Design a class, Table, that will be used to create table objects. Associated with each table object will be person objects, created from a class Person. There should be at least one constructor defined for the Table class, get and set methods, a method isSeatedAt(table, person) that returns a Boolean, and any other methods that you think might be useful.

For the Person class, there is a name associated with a person. The name will be of the format in the file 500names.txt The Person class should define at least one constructor, get and set methods, and a method that returns the length of the persons name.

Write the output of your program to System.out in the format:

image text in transcribed

The wedding planner does not have any problem with seating any particular name at at table, as long as the tables are full (m Persons) or almost full (n Persons).

Table 1 Aaron Smalls Abigail Frost Angel Later Adam X Table 2 Abdol Ahmet Afari Jamal Aged Genghis Agent Axis Absorbing Man

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

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

Prepare a short profile of Lucy Clifford ?

Answered: 1 week ago

Question

Prepare a short profile of Rosa parks?

Answered: 1 week ago

Question

Prepare a short profile of victor marie hugo ?

Answered: 1 week ago