logo

Java Programming Assignment (Doc)

22 Pages3494 Words297 Views
   

Added on  2019-10-16

Java Programming Assignment (Doc)

   Added on 2019-10-16

ShareRelated Documents
This project is worth 15% of your final mark. You can choose any topic which use JavaFX, EVENT HANDLING, FILES (SequentialOr Random) and ArrayList which match following project functionality.You can chose any project definition. First approve your project title and group member with me.You can work on group of two students or individually.Project Due: Monday 8thAugust Show your project working in person to me during our regular class period.You can show your project before due date also.Following are sample examples:Final Project Example1This describes an example of a final project. This project contains the basic functionality plus some extras that might be used to achieve some bonus marks for one person. This is not an example of a 2-person project.PR O J E C T OV E R V I E WThis project keeps track of courses offered in FAST. A user can add, edit, and delete course records. They can also view courses by category (e.g. Programming, Networking) and they can search for courses by course code or with a keyword in the title.
Java Programming Assignment (Doc)_1
Sample Final Project Screen - MainSample Final Project Screen - SearchProject Notes:You only need one search. The search by course code here is an extra. The search by title keyword would match the basic functionality required.The filtering of records in the list box by category is an extra and is not required to meet the project's basic functionality, but you would get bonus marks for including similar functionality.
Java Programming Assignment (Doc)_2
File DescriptionThe course file has the following structure:File:coursesDescriptionData TypeCommentscourse codeStringuniquely identifies a course (Primary Key)course titleStringthe title/name of the coursecredit valuedoublethe credit value for this coursecategoryintthe category number **** note for category field: In my case, I used an int to store the category number. Each number corresponds to a category, for example 1 is Business, 2 is Database, etc. The category info couldbe stored in a second file like this:File:categoriesDescriptionData TypeCommentscategory idintuniquely identifies a category (Primary Key)category nameStringthe name of the categoryYou could also use an enumeration instead of a file. If you will be frequently adding new categories, use a file. If you'll never add categories, use an Enum. It's easier to manage new
Java Programming Assignment (Doc)_3
categories with a file, but when using an Enum, new categories must be added in the Enum class by the programmer.U M L DI A G R A M SThe diagram below shows the classes used in the sample application. See the notes below.
Java Programming Assignment (Doc)_4
UML Diagram for Sample Final ProjectNotesCourse Class
Java Programming Assignment (Doc)_5
oThe constants CODE_SIZE, TITLE_SIZE, and RECORD_SIZE are constants needed for a random access file. You wouldn't need these if you were using a sequential file.oThe second toString() method with the boolean parameter is a trick used when you want to have two different toString() methods (you'll see in the screen shots later that Course objects in the main screen's list only show the course code, whereas Course objects in the Search Matches list on the Search screen show the course code and the course title. In my second toString(), I use the boolean as a "include course title" flag - when it's true, concatenate the course title to thecourse code, otherwise, just return the course code like the default toString() does.oThe compareTo() method is used to test and see if a second course is greater than, less than, or equal to the current course object. This is an override of the compareTo() method in the Comparable interface and it's used when I wanted tosort my CourseList course objects (this would be an extra feature to add for bonus marks or for working with a partner). If you didn't learn about the Comparable interface, you can find it in your textbook (it's pretty easy to figure out, but let me know if you need help!).ovalidCourseCode() is a private helper method I added to make sure the course code was valid (4 characters followed by 5 digits). This is something specific to this sample project but if you had a similar field, you'd probably want to make one or more validation methods, too.CourseList ClassoThere are quite a few constructors here - one default, one that takes a variable-length argument list of Course objects (which will also accept an array of Course objects e.g.CourseList list = new CourseList(new Course(..), new Course(..), new Course(..), ...);orCourse[] courses = new Course[10];// ... fill courses with course objects blah blah blah// ...CourseList list = new CourseList(courses);The last two constructors are for loading the list from a file - one takes a File object and the other takes a String for the file name/location. The String constructor simply constructs a File object and then calls CourseList(File).oMethods like get(), set(), add(), insert(), remove(), clear(), indexOf(), and size() mostly just call the ArrayList methods by the same name.oloadFromFile() loads the CourseList with Course objects that are constructed from records in a specific file.owriteToFile() takes each Course in the CourseList, creates a record string, and writes the string to the file. This overwrites the original file contents.
Java Programming Assignment (Doc)_6

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Introduction to Data Mining: Project Overview
|2
|599
|98

4100COMP Introduction to Computer Programming- Assignment
|6
|1385
|503