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

The Problem: You will write a program to manage a list of students registered fo

ID: 3831772 • Letter: T

Question

The Problem:

You will write a program to manage a list of students registered for classes. This program will manage adding a student to a class, removing a student from a class, displaying and updating student data. It will also write the update class list to output files.

Design

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

Create non-application classes Student.java, Course.java, Book.java

Create the application class CourseRegistration.java.

Download the input files (CourseData.txt, StudentRegistration.csv) that are in a zipped file in the assignment. Look at the data.

Student class

Instance variables:

The student ID of the student

The first name of the student

The last name of the student

The student’s major

The number of accumulated credit hours of the student

Methods:

Special constructor that accepts values for all instance fields

a method to update the number of accumulated credit hours. This method accepts number of credits hours that will be added to the accumulated hours for the student.

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

Name: <first name> <last name>

ID: <student id>

Major: <major>

Class: <student class level>

For displaying class level, use the table below to display the appropriate student class level:

Number of credit hours

Student class level

0 – 30 hours

Freshman

31- 60 hours

Sophomore

61 – 90 hours

Junior

Above 90 hours

Senior

Book class

Instance variables:

the isbn number for the book

the title of the book

the name of the author or authors

the publisher of the book

Methods:

Special constructor that accepts values for all instance fields

Getters for all instance fields

toString method that builds data for display for all instance fields with proper labels

Course class

Instance variables:

department ID for the department that the course belongs to

course ID for the class

course description

location for the class

an integer to store the number of credit hours for the class

name of the instructor

an instance of Book that will hold information about the textbook for the class. This will be null if there is no required textbook for the class

an array of Student objects that will hold information for each student registered in the class

a counter for the number of students registered in the class

Constants:

a constant that will hold the maximum number of students who can sign up for the class. This value would be 40.

Methods:

Special constructor that accepts values for department ID, course ID, courseName, location, number of credit hours, and the name of the instructor. In the constructor, you will create the array to hold Student objects.

A setter for the Book object and the instructor name

A getter for CourseID

a method addStudentToList that will accept an array of String values. The String array has all the values needed to create a Student object, and the object will be added to the array of Student objects. Display a message “Student not added since class is full” if the array is full. Otherwise, display a message “Registration successful.”

a method removeStudentFromList that will accept a student ID. The student ID will be used to find the student in the array and remove the student from the roster. Display “Student with student ID <insert student ID> not found.” if the student ID is not in the course list. Otherwise, display a message “Student successfully deregistered”.

a method displayStudentData that will accept a student ID. This method will display data for one student.

a method displayRoster that will display information for all the students in the array. Display the course ID, course description, and instructor name before displaying the list.

A method updateCreditHours that will update the accumulated credit hours for all students. It will pass the number of the credit hours for this class to the appropriate method in the Student class.

a private method findStudent that accepts the student ID that will be used to find a particular student. It will return the index value of where the student was found in the array. If not found, this method will return a -1.

a method writeToFile that accepts a String filename object to be used to create the output file. This method will write the contents of the array to the output in the same format as the input file. Output file will be the same as the input and will be a .csv file.

CourseRegistration class:

Create this class with same framework as in Program 5. Create a run() method, a getChoice() method, a validateChoice() method and isNumeric method. main() method should only create an instance of the application class and the call the run() method. Validation of menu option selected should be in getChoice(), which calls the validateChoice() method, same as in Program 5.

Declare the variables for 2 instances of Course objects at class level.

Create a private method that will accept the Scanner object created to read the CourseData.txt file. The 2 instances of Course objects will be created here. Simply read the data for each course and create the Course objects. Read the data for the textbook and call the setter for the Book object if there is a textbook required.

Create a private method that will accept the Scanner object created to read the StudentRegistration.csv file. It will read the data from the input file one row at a time. This method will read an entire row of student data and use the split() method discussed in class.

The menu should display as follows:

Conference Registration System

1 – Add a student

2 – Remove a student

3 – Change the Instructor

4 – Display class list

5 – Close registration

6 – Update credit hours

7 - Quit

Option 1 – Ask for all the data needed to add a student to the class and call the appropriate method to add the student.   Ask for the course ID and add the student to appropriate Course object.

Option 2 – ask the user for the student ID and the course ID, and call the appropriate method to remove the student from the list in the appropriate Course object.

Option 3 – ask user for the instructor name and course ID, and update the instructor in the appropriate Course object.

Option 4 – ask the user for the course ID and display the student list from the appropriate Course object.

Option 5 - will call the appropriate method to write the contents of the arrays in the Course objects to the appropriate output file.

Option 6 - will simply call the appropriate method in Course objects that will update the accumulated credit hours for each student in each class.

Option 7 – display message “Registration complete.” Before terminating the program.

Input and Output

Input file CourseData.txt format:

<department ID> <course ID>

<number of credit hours> <location of the class (building and room number)>

<course name>

<instructor name>

<isbn> <book title>

<author or authors>

<publisher>

If the class does not require a textbook, it will have “No textbooks required for this class” instead of the 3 lines of book data.

Input file StudentRegistration.csv data in each column:

<course ID><student ID>< first name><last name><major><credit hours>

Output files:

You will create 2 output files, one for each class. Name the output files “ClassRoster” + course ID.

ClassRosterIT-168.csv

ClassRosterENG-101.csv

Do not hardcode the course ID when naming the file. Add the course ID from the Course objects.

Data will be written to output file in the same format as the input file.

Number of credit hours

Student class level

0 – 30 hours

Freshman

31- 60 hours

Sophomore

61 – 90 hours

Junior

Above 90 hours

Senior

Explanation / Answer

import java.util.*; public class Student { private String m_name; private int m_age; private String m_course; private String m_year; private String m_section; public Student( String name, int age, String course, String year, String section ) { m_name = name; m_age = age; m_course = course; m_year = year; m_section = section; } public String getName() { return m_name; } public int getAge() { return m_age; } public String getCourse() { return m_course; } public String getYear() { return m_year; } public String getSection() { return m_section; } public String toString() { return "name: " + m_name + ", age: " + m_age + ", course: " + m_course + ", year: " + m_year + ", section: " + m_section; } public static void main(String[] args) { ArrayList students = new ArrayList(); Scanner input = new Scanner(System.in); int menuChoice = 4; do { System.out.println(" Student Record Menu"); System.out.println(" 1. Add Student 2. View Students 3. Search Student 4. Exit"); try { System.out.println("Enter a choice: "); menuChoice = Integer.parseInt(input.nextLine()); } catch (NumberFormatException e) { continue; } if (menuChoice==1) { System.out.println("Full name:"); String name = input.nextLine(); int age = -1; do { try { System.out.println("Age:"); age = Integer.parseInt(input.nextLine()); } catch (NumberFormatException e) { System.out.println("Enter a number!"); continue; } } while (age
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