Question: Write a program that displays information about the Computer Science semester schedule. Your program willrequiretwoJavafiles:yourmainprogramandaCourseclass. TheCourseclassmustcontainthe following class instance data: Write in java Cscourses.txt: COMP163
COMP163 Course Information Program Write a program that displays information about the Computer Science semester schedule. Your program will require two Java files: your main program and a Course class. The Course class must contain the following class instance data: data Course number CRN Instructor's last name Days the course is taught Start time of the class Room where the class will be held Title of the course example COMP163 20781 Williams 1000 Graham210 Intro to Computer Programming All data should be represented as strings. Your class must include a constructor method that initializes all the data values. No other methods are required if you make the data values public. The main program should read the file CScourses.txt and create a Course object for each course in the file. Each line of data in the file has the course information in the same order as shown above. Except for the title of the class, all data are one word separated by white space. As your program reads each line of the file, the Course object should be put into a hash table. A hash table is a data structure that allows you to retrieve information based on a key. Your program will put the Course objects in the table using the course number as the key. You will need to create a hash table object at the beginning of your program with java.uti1.Hashtablecstring, Course> hash-new java.util.HashtableO You can put data into the hash table using the put method and retrieve data using the get method. The put method has two parameters, the key and the object to be put in the hash table. The get method has only one parameter, the key to be used to find the corresponding object. To put the data in the hash table use Course csClass = new Course ( courseNumber, crn, oderparameters) ; hash.put( courseNumber, esclass) After your program has read all of the data from the file, it should ask the user to enter a course number (such as COMP163) from the keyboard. It should then use the get method to find the data in the hash table and display the information. The get method will retun the Course object with the given course number. If the get method does not find a class in the hash table with that number, it will return null. Your program must check if the returned value is equal to null and, if it is, display a message indicating there is no such class. EnteredNumber-keyboard.next course found hash.get( EnteredNurber ); if (found == null l if course is not in the table page I of2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
