[Solved] Lab Use List Simulate Manage Program Study Program Study Refer List Courses Student Takes Q37275302
In this lab, you use a list to simulate and manage a program ofstudy. By program of study, we refer to list of courses that astudent takes to fulfill degree requirements.
The program consists of three classes: a Course class thatrepresents a course that might be taken by a student, aProgramOfStudy class that represents a list of courses taken andplanned for an individual student and POSTester class that acts asa driver class.
Course Class
Define a Course a class that has four instance variables:Prefix (a String), number (an integer), title (a String) and grade(a String). For instance for the following course:
CS 101: Introduction to Programming
“CS” is the prefix, 101 is the course number, “Introduction toProgramming” is the tile and grade might be empty or any of lettersthat represent a grade.
Define 2 constructors for the course class: one thatconstructors the course the specified information and has thefollowing signature:
public Course(String prefix, int number, String title, Stringgrade)
The second constructor constructs the course without the gradeand has the following signature:
public Course(String prefix, int number, String title)
Define getter methods for all of variables and setter methodonly for grade that might be set later.
Define method boolean taken() that returns true if a coursehas a grade associated with it.
Define method boolean equals(Object other)that Determines ifthis course is equal to the one specified, based on the coursesprefix and number.
Define toString() method that Creates and returns a stringrepresentation of this course similar as follows:
CS 101: Introduction to Programming [A-]
Modify course class to implement serializable interface.Implementing serializable interface allows you to save objects of aclass and load them for the future runs of the program.
ProgramOfStudy Class
Define ProgramOfStudy a class that has one instance variables:the instance variable called list is declared to be of type List,which refers to the list interface.
Define a constructor public ProgramOfStudy(). In theconstructor, a new LinkedList object is instantiated.
Define void addCourse(Course course) method tdds the specifiedcourse to the end of the course list.
Define Course find(String prefix, int number) that finds andreturns the course matching the specified prefix and number.
Define void addCourseAfter(Course target, Course newCourse)that Adds the specified course after the target course. Doesnothing if either course is null or if the target is not found.
Define void replace(Course target, Course newCourse) Replacesthe specified target course with the new course. The method doesnothing if either course is null or if the target is not found.
Define String toString() method that creates and returns astring representation of this Program of Study as follows:
CS 101: Introduction to Programming [A-]
ARCH 305: Building Analysis [A]
FRE 110: Beginning French [B+]
CS 320: Computer Architecture
CS 321: Operating Systems
THE 201: The Theatre Experience [A-]
Define class void save(String fileName) throws IOExceptionthat saves a serialized version of this Program of Study to thespecified file name.
Define class ProgramOfStudy load(String fileName) throwsIOException, ClassNotFoundException that Loads a serialized Programof Study from the specified file.
POSTester Class
POSTester program is attached with the assignment. You may useit to test your program.
POSTester.java
import java.io.IOException;
/**
* Demonstrates the use of a list to manage a set of objects.
*
* @author Java Foundations
* @version 4.0
*/
public class POSTester
{
/**
* Creates and populates a Program of Study. Then savesit using serialization.
* @throws ClassNotFoundException
*/
public static void main(String[] args) throwsIOException, ClassNotFoundException
{
ProgramOfStudy pos = newProgramOfStudy();
pos.addCourse(new Course(“CS”,101, “Introduction to Programming”, “A-“));
pos.addCourse(new Course(“ARCH”,305, “Building Analysis”, “A”));
pos.addCourse(new Course(“GER”,210, “Intermediate German”));
pos.addCourse(new Course(“CS”, 320,”Computer Architecture”));
pos.addCourse(new Course(“THE”,201, “The Theatre Experience”));
Course arch = pos.find(“CS”,320);
pos.addCourseAfter(arch, newCourse(“CS”, 321, “Operating Systems”));
Course theatre = pos.find(“THE”,201);
theatre.setGrade(“A-“);
Course german = pos.find(“GER”,210);
pos.replace(german, newCourse(“FRE”, 110, “Beginning French”, “B+”));
System.out.println(pos);
pos.save(“ProgramOfStudy”);
ProgramOfStudy test =pos.load(“ProgramOfStudy”);
System.out.println(test);
}
}
If you could help that would be great.
Expert Answer
Answer to In this lab, you use a list to simulate and manage a program of study. By program of study, we refer to list of courses … . . .
OR

