Question
CSC142 Programming Assignment #4 Spring, 2018 This program assigns seating for a math class at Central. If you have taken a math class here, you
CSC142 Programming Assignment #4 Spring, 2018
This program assigns seating for a math class at Central. If you have taken a math class here, you have noticed that tables are arranged for group work, each table seating 4 persons. For group activities, you must have a seating arrangement of either 3 or 4 persons per table. It is not allowed to have a table with only 1 or 2 persons seated.
Design a class, Table, that will be used to create table objects. Associated with each table object will be 3 or 4 person objects, created from a class Person.
For the Person class, there is a name associated with a person. The name will read from 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. You may decide to store the first and last names as separate fields, but that is up to you.
For the Table class, there are a number of persons associated with each table. There should be at least one constructor defined, getter and setter methods, and a toString method (see page 170) that prints the names of all persons seated at a table.
You will be reading the student names from the file 500names.txt. We will cover the mechanism for doing that in class, or you can read ahead to figure out how to read the names from the file using the Scanner class.
For now, your application should read 32 names from the file, assign them to tables, and print out the names assigned to each table:
Table 1
----------------
Abdol Ahmet
Abner Little
Abominable Snowman
Absorbing Man
Table 2
-----------------------
Adam X
Afari Jamal
Aged Genghis
Agent Axis
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started