Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design a Course class with id and name ( both String type ) with a constructor that takes all the data fields as arguments. A

Design a Course class with id and name (both String type) with a constructor that takes all the data fields as arguments. A course id is fixed in length whereas the course name may change in the number of characters. Use some courses from your software engineering 4-year program. (5 points)
Design a Student class with id, fullName (both String type), and a list of courses (Course type) data fields with a constructor that takes all the data fields as arguments. Student's id's are fixed in size but full name is not. (10 points)
Your main function should start by reading the students.bin binary file into a list of students (more on this file later) and calling a function that presents a menu to the user. Menu options should be
a. Create a student and add it to your list of students. Make sure that id is unique for each student, that is, your application should enforce that. The Uniqueness constraint of id's could be implemented as a later step. Think of ways to accomplish this. (15 with uniqueness)
b. Search the list of students by id or name. Search should return a list of students. And print them to the terminal using only their id and full name. (20 points)
c. Delete a student from the list given an id (using the search results in (b) or if the id of the student is known)(25 points)
d. Update a student from the list given an id (using the search results in (b) or if the id of the student is known)(30 points)
e. Print only the full names of the students to the terminal stored in the list of students. (35 points)
f. Print the courses taken by a student given the student id (using the search results in (b) or if the id of the student is known)(40 points)
g. Send the obtained information based on these queries. More on this later.
h. Save the list of students to a binary file in the format described below. This will be implemented as a step below.
i. Exit the application. Termination of the application should save the in-memory representation of the list of students in the file. Note that you have a list of students in a list (in memory when your application is running) and an in-file version of it, both of which might be different. Why? Saving the list of students to its file will synchronize the two, that is, they will be the same.
Note that at this point since you do not have to save the list of students to a file, you can create student objects in the main function and add them to your list to test the above steps without having to read the file to populate your list of students when you start your application.
List of students should be saved to a binary file using the following format. You can only use FilelnputStream and FileOutputStream classes for writing to and reading from the file that contains the students' information. (85 points)
A Student's information should be saved in the order of id, full name and courses taken. id is fixed in length so that we can set aside a fixed number of bytes to store it, that is, with no additional data with it. Since the length of a full name can change, we cannot allocate a fixed number of bytes for it in the file following the id. You will use two bytes to specify the length of the student's name right after id followed by the full name of the student. The two bytes specifying the length of the full name should be in Big Endian notation. For example, if the student's name is "Ahmet Yardimsever", then the full name should take 19 bytes in the file (2+17), note the space between the first and last name. The courses taken by a student should follow the full name. The total length of the courseldcourseName pairs should be preceded by the number of bytes needed to represent them (the same as with the full name) where the courseldcourseName pairs are separated by a colon( from each other. Once all the courseldcourseName pairs are read from the file they can be parsed using the ":" as separators. Each pair then can be parsed since courseld has a fixed size.
Note that Step 4 can be skipped since you can work with an in-memory students list.
Create an abstract class called DataTransfer with a single abstract method called sendData that takes the data as String type. (87 points)
Create a subclass of DataTransfer called Email overriding the sendData method. sendData should prompt the user for an email address and send the data to that address. Use your gmail account to send the email (probably to yourself). Check your email to make sure that you received it.(95 points)
Create a subclass of DataTransfer called ToFile overriding the sendData method. sendData should prompt the user for filename and save the data in a text based form. Make sure all data is parsable. Open the file with a text editor and make sure that all data are readable and parsable. (100 points)
Steps 5,6 and 7 should be implemented in a way so that you will use polymorphism to get full credit. Let the user choose the method of transferring data.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions