Java Programming Assignment (Doc)

Added on - Oct 2019

Trusted by 2+ million users,
1000+ happy students everyday
Showing pages 1 to 6 of 22 pages
This project is worth 15% of your final mark.You can choose any topic which use JavaFX, EVENT HANDLING, FILES (SequentialOr Random) and ArrayListwhich match following project functionality.You can chose any project definition. First approve your project title and group member withme.You can work on group of two students or individually.Project Due: Monday 8thAugustShow 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 plussome extras that might be used to achieve some bonus marks for one person. This is not anexample of a 2-person project.PR O J E C TOV E R V I E WThis project keeps track of courses offered in FAST. A user can add, edit, and delete courserecords. They can also view courses by category (e.g. Programming, Networking) and they cansearch for courses by course code or with a keyword in the title.
Sample Final Project Screen - MainSample Final ProjectScreen - SearchProject Notes:You only need one search. The search by course code here is an extra. The search by titlekeyword 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 theproject's basic functionality, but you would get bonus marks for including similar functionality.
File DescriptionThe course file has the following structure:File:coursesDescriptionData TypeCommentscoursecodeStringuniquely 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 numbercorresponds 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)categorynameStringthe name of the categoryYou could also use an enumeration instead of a file. If you will be frequently adding newcategories, use a file. If you'll never add categories, use an Enum. It's easier to manage new
categories with a file, but when using an Enum, new categories must be added in the Enumclass 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.
UML Diagram for Sample Final ProjectNotesCourse Class
oThe constants CODE_SIZE, TITLE_SIZE, and RECORD_SIZE are constants neededfor a random access file. You wouldn't need these if you were using a sequentialfile.oThe second toString() method with the boolean parameter is a trick used whenyou want to have two different toString() methods (you'll see in the screen shotslater 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 showthe course code and the course title. In my second toString(), I use the booleanas 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 greaterthan, less than, or equal to the current course object. This is an override of thecompareTo() 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 forbonus marks or for working with a partner). If you didn't learn about theComparable interface, you can find it in your textbook (it's pretty easy to figureout, but let me know if you need help!).ovalidCourseCode() is a private helper method I added to make sure the coursecode was valid (4 characters followed by 5 digits). This is something specific tothis sample project but if you had a similar field, you'd probably want to makeone 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 Courseobjects e.g.CourseList list = new CourseList(new Course(..), new Course(..), newCourse(..), ...);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 Fileobject and the other takes a String for the file name/location. The Stringconstructor 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 constructedfrom records in a specific file.owriteToFile() takes each Course in the CourseList, creates a record string, andwrites the string to the file. This overwrites the original file contents.
Desklib Logo
You are reading a preview
Upload your documents to download or

Become a Desklib member to get access