This next simple assignment will allow you to practice I/O with Multi-Threading.

Prerequisites for this Assignment: Completed Homework 3 properly. If you have errors in it, fix it or risk losing points again.

What needs to be added:

1) Create two methods in your Main class (The class that host your main method)

i) WriteDataToFile - This method should only contain Homework 3 codes that randomize all attributes for the Student object. No instantiation of Student objects are allowed in this method. You need to use FileWriter or any other file writing class you have learned so far to randomly generate each student record and write it on a text file. (I allow freedom in how you should choose to write a student record in each line of your text file but you should write it in such a way that allows you to parse your student record correctly)

ii)ReadDataFromFile - This method should only contain Homework 3 codes that instantiate Student objects. This code MUST read from the text files that you have created from your first method. Ideally, you should code it in such a way that you can dynamically set the text filenames dynamically such as using command line arguments I spoke of during the lab, but I will accept hardcoding of the filenames. If you have done WriteDataToFile method correctly, you should not have any problems reading from the file. Use the scanner class to help you with this assignment. Remember that the Scanner class already have the built-in next() and nextDouble() method available so that you do not have to reinvent the wheel.

You can decide what the signatures of these two methods should be.

Please note that you will be judged based on your knowledge in object-oriented programming. I will allow minor mistakes but not serious coding errors that shows lack of knowledge.

2) In your main, you MUST call WriteDataToFile method first, before calling ReadDataFromFile. They MUST be invoked separately and does not depend on each other. (E.g., Simulate two different departments doing different tasks)

[Here comes the multi-threading part:]

3) Using Multi-threading knowledge you learned in lecture and in labs, modify your codes again so that you will write data to at least 3 DIFFERENT files concurrently.

4) Using Multi-threading knowledge you learned in lecture and in labs, modify your codes again so that you will read data from at least 3 DIFFERENT files concurrently. Calculate the average GPA in each file and display the results.

5) You MUST use different multi-threading techniques for writing and reading. So, if you used the inheritance technique for multi-threaded writing, then you must use the interface technique for the multi-threaded reading and vice versa.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.