Java project, computer programming, Programming Languages

Assignment Help:
NOTE: You will only submit the University.java and EmptyFileException.java files (inside P3.zip/tar)

NOTE on null objects:. From Project 1: Since the array of students in the Course class might have no objects (null), remember to do a null check when traversing the array.

UPDATE March 23rd: There was a slight error in the "university.txt" file provided for part A. Please make sure you work with the latest version.

NOTE: You should NOT modify any classes other than University.java.
Description:

For this project you will be storing and retrieving the Sakai system implemented in project 1.
You will first need to download the solution to project 1.
There are two parts to the project:

PART A:. This part involves writing out all the information to a file. Modify the University.java file by adding this method:
public boolean writeToFile(String filename):
-The method should write out all the information to the filename passed in. If successfully written it returns true, otherwise false.
-The file format is as follows: (parentheses indicate the information has to be written out)

University Name: (university''s name)
Current Term: (currentTerm)
Current Year: (currentYear)
Number of Students: (number of students)
Number of Instructors: (number of instructors)
Number of Courses: (number of courses)

The information above is to be written out first. Immediately following the above the information for each student has to be written out as specified below:

Undergrad/Grad Student:
Name: (student''s name)
UFID: (student''s ufid)
D.O.B: (student''s dob)
GPA: (student''s gpa)
Number of Courses: (number of courses the student is enrolled in)

Immediately following the above the information for each instructor has to be written out as specified below:

Instructor:
Name: (instructor''s name)
UFID: (instructor''s ufid)
D.O.B: (instructor''s dob)

Immediately following the above the information for each course has to be written out as specified below:

Course:
(type) (number)
(title)
Number of credits: (numCredits)
Instructor UFID: (UFID of the instructor)
Number of TAs: (number of TAs)
TA UFIDs: (ufid of first ta),(ufid of second ta),...,(ufid of last ta)
Capacity: (capacity)
Current Enrollment: (currentEnrollment)
Student UFIDs: (ufid of first student),(ufid of second student),...,(ufid of last student)


That signifies the end of the file.


Use TestDriver1 to test your solution to Part A.
This driver will produce a file named university.txt. Use the output file provided to compare whether your program writes it out properly.

PART B: This part will involve reading from a file and reconstructing all the objects in the Sakai system.

Create the class EmptyFileException, which will be a subclass of Exception.. This exception is thrown when a file is empty. It will have the following properties and methods:
Properties:
----------
- String filename; // This represents the name of the file which is empty

Constructors:
------------
- EmptyFileException()
Empty constructor which does nothing
- EmptyFileException(String filename)
Takes in the name of the file which is empty and set''s the properties appropriately

Methods:
--------
public String toString();
It will return a string in this format:

The file (filename) is empty.


Modify the University.java file by adding this method:
public static University readFromFile(String filename):
-This method will read in all the university info from a file and construct the university object.
-If the object is properly created it is returned, otherwise a null object is returned.
-If the file to read from is empty, the method will try-and-catch the EmptyFileException created above.
When the exception is caught it''s information is printed out (via the toString method).

(HINT: Try to use helper methods for reading in different kinds of objects - Student, Instructor and Course.)

Use TestDriver2 to test your solution. It tries to read in the university.txt file. Compare with our output.

Related Discussions:- Java project, computer programming

Maze game, The Maze Game from Laboratory 7 loads its maze directly in the p...

The Maze Game from Laboratory 7 loads its maze directly in the program's code. This should be avoided as it requires the program to be recreated if the maze needs to be changed. In

Example of undetermined coefficients, Example :  Solve the following differ...

Example :  Solve the following differential equation. y (3)   -  12 y''+48 y' + 64 y = 12 - 32 e -8t + 2 e 4t Solution :    We first require the complementary solution

Python (using os.walk), Using os.walk, write a script that will print the f...

Using os.walk, write a script that will print the filenames of zero length files. It should also print the count of zero length files.

Frotran 2000, Please explain about sub programming.

Please explain about sub programming.

Programming code for supermarket software , The software development team i...

The software development team identified the following classes based on the analysis of given requirements: Product, Employee, ProductList, Supplier. 1.  Identify the relationsh

Draw a use case diagram in uml for order book, SailDublin Ferry provides fe...

SailDublin Ferry provides ferries to mainland Britain, Europe and America. Having observed the success of Irish ferries and Stennaline online booking system; SailDublin ferry has d

A traveler wants to purchase a number of traveler''s checks, A traveler wan...

A traveler wants to purchase a number of traveler''s checks, each having a set amount for four different currencies: Mexican pesos, Euro dollars, Swiss francs, and US dollars. A t

We need advancement in existing phonegap application, We need Advancement i...

We need Advancement in Existing PhoneGap Application We need a PhoneGap expert to aid us extend an existing PhoneGap application. The app works pulls data from a new website (de

Write a function called triple, Write a function called triple (in a file c...

Write a function called triple (in a file called 'triple.m'). That takes a single variable x and returns a single variable in which every element of x is multiplied by 3. Make sure

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd