Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Program 6 You will write a program to manage a list of people attending a confer

ID: 3690687 • Letter: P

Question

Program 6

You will write a program to manage a list of people attending a conference. The conference is on a Saturday and there are two sessions that participants can sign up for. The morning session is from 9 am – 12 pm. The afternoon session is from 1 pm – 4 pm.

The Design:

~ The classes should be placed in a package with the name edu.ilstu.program6

~ An input files have been provided. Open and understand the data and the format.

You will need to use the following classes for your program:

Person class

Instance variables:

~ first name of the conference participant

~ last name of the conference participant

~ the name of the company the participant works at

~ registration code assigned to participant at registration

Methods:

~ Special constructor that takes a Scanner object. The Scanner object will be used to read data for

one participant from the input file.

~ getters first name, last name and company name

~ toString method that will build a String literal value using the format below:

Name: <first name> <last name> Company: <company name>

Session class

Instance variables:

~ the session time – AM (morning session from 9 – 12 pm) or PM (afternoon session from 1 pm –

4 pm

~ a Person object to represent the facilitator for the session

~ an array of Person objects that will represent the participants attending the conference

~ number of participants already registered for the conference

Constants:

~ a constant that will hold the maximum number of participants that can sign up for the session.

This value would be 30.

Methods:

~ Special constructor that accepts values for the session time (AM or PM) and a Person object for

the facilitator.

~ a method loadArray that will accept a Scanner object that will be used to read data into Person objects when Person objects are loaded into arrays. You will only load the data for Person objects signed up for the session, i.e. if session time for this object is AM, only load data for AM participants.

~ a method addToList that will accept a Person object. The Person object represents a participant who just signed up and need to be added to the list.

~ a method removeFromList that will accept a registration code. The registration code will be used to find the participant in the array and remove the participant from the list of attendees. This method will call the private method that returns the exact location of the participant in the array. The value returned by the private method will be used in the process of removing the participant from the array.

~ a method changeFacilitator that accepts a Person object which represents the new facilitator being assigned to the session.

~ a method that will display the contents of the array. It will only display the participants name and company name. Which method should be called?

~ a private method findParticipant that accepts the registration code of the participant who withdrew from the session. The registration code will be used to search for the participant in the array, and return the index value of where the participant was found in the array. If not found, this method will return a -1.

~ a method writeToFile that accepts a PrintWriter object. The PrintWriter object will be used to write the contents of the array the output file “UpdatedList.txt” in the same format as the input file.

ConferenceApp class:

~ Open the input file for reading. The input file has been provided, open it and look at the data in

it.

~ Create two (2) Session objects, one for morning and one for afternoon session. Load the arrays of Person objects using the data from the input file into the correct Session object.

~ Display a menu that the user will select from. The menu should display as follows: Conference Registration System

1 – Add a participant
2 – Remove a participant
3 – Change the Facilitator
4 – Display the list of participants

5 – Close registration

6 - Quit

~ Option 1 – display the number of slots still available in the morning and afternoon session. Then ask the appropriate questions to complete the process of adding a participant to a session, including the registration code. After adding a participant to the list and the maximum number of slots is reached, display the message “Session is full.”

Below is just an example:

AM session: 5 PM session: 10

Enter first name: Anne
Enter last name: Dangerfield
Enter company name: Haley’s Comet Enter session: AM

~ Option 2 – ask the user for the registration code and session time (AM or PM) which will be used to find the participant and remove the participant from the appropriate list.

~ For option 3 - ask user for the appropriate information needed to complete the process. The registration code for facilitators will be null. Below is just an example:

Enter first name: Anthony
Enter last name: Mallard
Enter Company name: Illinois State University

~ Option 4 will simply display the list of all participants by session. Display the list of participants in the morning session with the title “Morning Session List”. Then display the list of participants in the afternoon with the title “Afternoon Session List”. There should be a blank line between each participant information.

Morning Session List <first and last name> <company name>

<first and last name> <company name>
...

Afternoon Session List <first and last name> <company name>

<first and last name> <company name>

...

~ Option 5 will write the contents of the arrays in the Session objects to the same output file, same format as the input file. Display “Registration closed.” when done.

~ Option 6 will terminate the application. You should not need to use “System.exit(#)” to do this. See how it is set up in Lab 14.

If option entered is not 1 – 5, display the message “Invalid option. Please make another selection.”

Input and Output

Input file Participants.txt format: <session>

< first name>
< last name> <company name>
< registration code>

Output file:
UpdatedList.txt will hold the updated list of participants in each session. It will have the same format as the input file.

Generating Javadocs

Create javadocs for your Person and Session classes. To do this:

Go to the Project menu and choose Generate Javadoc...

Under the “Select types...” window in the left, expand the folder for Program6, then the src folder. Then select the package name.

After selecting the package name, the classes in this package will appear on the right window.

Select Person and Session only.

In the Javadoc command dropdown, select the Configure... button. The location of the

Javadoc.exe file needed to generate the javadocs in the virtual machines is in:

C:Program FilesJavajdk1.8.0_65injavadoc.exe

NOTE: For the javadoc files to be correct, all of your javadoc comments must be correct and in the right places in the code. Open the generated html file, read it, correct any poorly formed Javadoc comments in your .java file and recreate the html file as many times as necessary before submitting.

Participants.txt :

AM
Carrie
Anderson
Colors Unite
4GH3
AM
Marie Ellen
Smythe
Suncor
233D
PM
James
Hildebrand III
Medco
12R4
AM
Amelia Jane
Foxhill
ConocoPhillips
8776
AM
Aslan
Lionheart
Woodside, Inc.
4534
PM
Matthew
Humphreys
Devon Industries
3GH1
PM
Emma
Woodhouse
Acme Incorporated
SKL2
AM
Eva Nancy
Kelly
Anderson, Ltd.
WTTE
PM
Samuel
King
Reliance
BNN7
AM
Daniel
Woodhouse
Acme Incorporated
RR45
PM
Jennifer
Allegra
International House
12BV
PM
Emma Lynn
Rodriguez
General Electric
AAAA
AM
Carlos Miguel
Villanueva
Generations Plus
34H3
PM
Serena
Marion
Elemental Living
EDDI
AM
Jason
Whitehouse
Accents Inc.
1234
AM
Javier
Lee
TDF Technology
LL2L
AM
Alex
Gunderson
Semantic Living
BNM3

Explanation / Answer

Person.Java

package edu.ilstu.program6;

import java.util.Scanner;

/**
* Person Model Class that holds person inforamtion
*
* @author yourName
*
*/
public class Person {
   private String firstName;
   private String lastName;
   private String companyName;
   private String registrationCode;

   // Default Constructor
   public Person() {

   }

   /**
   * Parameterized Constructor
   *
   * @param sc
   */
   Person(Scanner sc) {

   }

   /**
   * @return the firstName
   */
   public String getFirstName() {
       return firstName;
   }

   /**
   * @param firstName
   * the firstName to set
   */
   public void setFirstName(String firstName) {
       this.firstName = firstName;
   }

   /**
   * @return the lastName
   */
   public String getLastName() {
       return lastName;
   }

   /**
   * @param lastName
   * the lastName to set
   */
   public void setLastName(String lastName) {
       this.lastName = lastName;
   }

   /**
   * @return the companyName
   */
   public String getCompanyName() {
       return companyName;
   }

   /**
   * @param companyName
   * the companyName to set
   */
   public void setCompanyName(String companyName) {
       this.companyName = companyName;
   }

   /**
   * @return the registrationCode
   */
   public String getRegistrationCode() {
       return registrationCode;
   }

   /**
   * @param registrationCode
   * the registrationCode to set
   */
   public void setRegistrationCode(String registrationCode) {
       this.registrationCode = registrationCode;
   }

   public String toString() {
       return "Name:" + firstName + lastName + " Company:" + companyName;
   }
}

Session.java

package edu.ilstu.program6;

import java.io.PrintWriter;
import java.util.Scanner;

public class Session {
   final private int NUM_OF_PARTICIPANTS = 30;
   private int sessionTime;
   Person person;
   Person[] personArray;
   int numberOfParticipants;

   Session(int sessionTime, Person person) {

   }

   public void loadArray(Scanner sc) {

       sc=new Scanner(System.in);
   }

   public void addToList(Person per) {

   }

   public void removeFromList(String registrationCode) {

   }

   public void changeFacilitator(Person person) {

   }

   public void findParticipant(String registrationCode) {

   }

   public void writeToFile(PrintWriter printWriter) {

   }

   /**
   * @return the sessionTime
   */
   public int getSessionTime() {
       return sessionTime;
   }

   /**
   * @param sessionTime
   * the sessionTime to set
   */
   public void setSessionTime(int sessionTime) {
       this.sessionTime = sessionTime;
   }

   /**
   * @return the person
   */
   public Person getPerson() {
       return person;
   }

   /**
   * @param person
   * the person to set
   */
   public void setPerson(Person person) {
       this.person = person;
   }

   /**
   * @return the personArray
   */
   public Person[] getPersonArray() {
       return personArray;
   }

   /**
   * @param personArray
   * the personArray to set
   */
   public void setPersonArray(Person[] personArray) {
       this.personArray = personArray;
   }

   /**
   * @return the numberOfParticipants
   */
   public int getNumberOfParticipants() {
       return numberOfParticipants;
   }

   /**
   * @param numberOfParticipants
   * the numberOfParticipants to set
   */
   public void setNumberOfParticipants(int numberOfParticipants) {
       this.numberOfParticipants = numberOfParticipants;
   }

}

ConferenceApp.java

package edu.ilstu.program6;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ConferenceApp {
   public static void main(String[] args) throws IOException {
       Person[] personArray;
       List<Person> personListAM = new ArrayList<Person>();
       List<Person> personListPM = new ArrayList<Person>();
       Person person = null;
       Scanner sc = new Scanner(System.in);
       BufferedReader br = new BufferedReader(new FileReader(
               "Participants.txt"));
       String data;
       int count = 0;
       String session = null;
       while (null != (data = br.readLine())) {
           if (count == 0) {
               session = data;
               person = new Person();
           }
           if (count < 4) {
               if (count == 1) {
                   person.setFirstName(data);
               } else if (count == 2) {
                   person.setLastName(data);
               } else if (count == 3) {
                   person.setCompanyName(data);
               } else if (count == 4) {
                   person.setRegistrationCode(data);
               }
               count++;
           } else {
               if (session.equals("AM")) {
                   personListAM.add(person);
               } else if (session.equals("PM")) {
                   personListPM.add(person);
               }
               count = 0;
           }
       }

       Session s1 = new Session(9, new Person());
       personArray = new Person[personListAM.size()];
       for (int i = 0; i < personListAM.size(); i++) {
           personArray[i] = personListAM.get(i);
       }
       s1.setPersonArray(personArray);

       Session s2 = new Session(12, new Person());
       personArray = new Person[personListPM.size()];
       for (int i = 0; i < personListPM.size(); i++) {
           personArray[i] = personListPM.get(i);
       }
       s2.setPersonArray(personArray);

       System.out.println("Conference Registration System"
               + " 1 – Add a participant" + " 2 – Remove a participant"
               + " 3 – Change the Facilitator"
               + " 4 – Display the list of participants"
               + " 5 – Close registration" + " 6 - Quit");
       String choice = sc.next();
       switch (choice) {
       case "1":
           System.out.println("AM session: 5 PM session: 10");
           System.out.println("Enter first name:");
           sc.next();
           System.out.println("Enter last name:");
           sc.next();
           System.out.println("Enter company name:");
           sc.next();
           System.out.println("Enter session:");
           sc.next();
           break;
       case "2":
           System.out.println("Enter Registration code:");
           sc.next();
           System.out.println("Enter session time:");
           sc.next();
           break;
       case "3":
           System.out.println("Enter first name:");
           sc.next();
           System.out.println("Enter last name:");
           sc.next();
           System.out.println("Enter company name:");
           sc.next();
           break;
       case "4":
           System.out.println("Morning Session List");
           for (int k = 0; k < s1.getPersonArray().length; k++) {
               Person[] array = s1.getPersonArray();
               System.out.println(array[k]);
           }

           System.out.println("Afternoon Session List");
           for (int k = 0; k < s2.getPersonArray().length; k++) {
               Person[] array = s2.getPersonArray();
               System.out.println(array[k]);
           }
           break;
       case "5":
           //OutputWriter writer=out
           break;
       case "6":
           System.exit(0);
       default:
           System.out.println("Invalid option. Please make another selection");
       }

   }
}

Note:

Hi i have created the code what i exactly understand from the given description.

But i didn't get exactly what was the requirement for you.

lot of confusion was there in the question.what exactly ineed to do after loading the array of persons from file.

Could you please give me the information.

Please look at the code i have done upto reading the file and populated the array,

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote