CST8284 Object Oriented Programming Assignment

Assignment Help JAVA Programming
Reference no: EM132402872

CST8284 - Object Oriented Programming (Java) - Algonquin College Assignment

Program Description

In this assignment you'll add more features to your Appointment Scheduler. For those students who failed to submit Assignment 2 you may use my copy, available on Brightspace, as the starting point for your Assignment 3 code, without citation.

I. Create an Assignment3 project and copy your existing classes to the new Project

a) Create a new CST8284_19F_Assignment3 project folder, copy the scheduler and employee packages from Assignment2 (including all its classes) to the new project, and refactor the name of the old package to cst8284.asgmt3.scheduler.

b) There is no UML diagram for this assignment; you are free to implement the requirements any way you wish, so long as it's within the existing UML framework established in Assignment 2. Note however that the principles of good code design still apply. So, at the marker's discretion, you will lose marks for not implementing best practices such as, e.g. not using getters and setters, not practicing code reuse, not employing chaining, not employing the principle of least privilege in your code design, sloppy design, etc.

(The same goes for the output. There are a limited number of changes to the program output, and all of them are related to the message and description implemented in section II(a). Aside from the actual wording-given below-you only need to decide what to put into your toString() method for output.)

II. Add the following new features to your Appointment Scheduler
a) Throw a BadAppointmentDataException to catch data input errors
Add a new BadAppointmentDataException class to your project, which extends from RuntimeException. Add two constructors to your new class: a no-arg constructor and a two- String constructor. The former constructor passes the Strings "Please try again" and "Bad data entered" to the latter via chaining. The two- String constructor uses super() to pass the first String up to the superclass (just as you did in Lab 7) so that it will be returned when you call ex.getMessage(). The second String is stored to a private String field called Description, which you'll need to add to your new exception, along with appropriate getters and setters.

In your existing code, throw a BadAppointmentDataException for each of the kinds of errors indicated in the table on the next page. The message to be displayed-the first String passed to your exception-is indicated in the right column, while the description of the error-the second String-is indicated on the left; you can use your new getDescription() method whenever you need to output this String.

Your lab professor will be running a series of tests on your code to check that each type of BadAppointmentDataException is thrown correctly with the appropriate information displayed for each error conditions indicated. So test your code thoroughly.

b) Refactor your code to sort and search Appointments using the Comparator interface
Recall that in Assignment 2 we searched through our ArrayList of Appointments using the same mechanism as in Assignment 1: by laboriously searching through each element until we found the Calendar object we were looking for.
Clearly, there's a better way to do this.

The ‘better way' is to sort the ArrayList first by its Calendar date. Then, when we wish to locate an Appointment, the search is much faster and more efficient. To organize the Appointments by date, we first need to implement a Comparator, so begin by creating a new class SortAppointmentByCalendar that implements the Comparator interface. Inside that class, you'll need to override the compare() method so that it returns an integer value representing the difference between the Calendar's of the two Appointment's input as parameters to the compare() method. Then, use an instance of your SortAppointmentByCalendar object to sort the ArrayList using the Collections sort() method (but be sure to use the overloaded version that takes a comparator as its second parameter). For details on this, see the course notes, or consult the web for guidance (as always, be sure to cite your sources). The following will help get you started:


Once your comparator is built and tested, searching for a particular Appointment by Calendar date is straightforward, this time using the Collections.binarySearch() method. Again, you'll probably want to do some research on this.

You'll want to use the overloaded binarySearch() method, the one with the signature:

public static <T> int binarySearch (List<? extends T> list, T key, Comparator<? super T> c)

That is, use the binarySearch() method that takes as its third parameter the same Comparator object you used in the sort() method.

Use the Collections sort() and binarySearch() methods in your existing code to refactor the findAppointment() method. (You may also find that other methods need refactoring as well once you make the change, depending on how you implemented your code.)

Finally, note that if each time you save an Appointment (in saveAppointment()), you sort the ArrayList as well, you can save yourself some time whenever you need to search the ArrayList.

c) Document your code using JavaDoc
JavaDoc adds hypertext-linked documentation to your code-you saw it briefly in Lab 1-allowing you to output rich text comments similar to those seen on the Oracle web site for each Java class. Provided, that is, you take the time to write and lay out your comments correctly. (See the sample documentation, available at the Oracle web site, below.) A good place to begin with JavaDoc is which explains what each tag does. For this assignment, the following tags are essential:

For the class: For methods/constructors
@author @param
@version @returns
@throws
You can safely ignore @see and @since for this assignment. Feel free to implement any other JavaDoc and HTML tags you feel are appropriate. You'll need to refer the Algonquin College Documentation Standard (ACDS), a set of (somewhat dated) slides indicating which components of your code need to be documented (short answer: pretty much everything). The document is available on Brightspace. The ACDS specifies that you must document both the file and the class (because a file may contain more than one class.) In this assignment, you're fee to ignore the first requirement: document each class only.

Your efforts to document your code correctly will all be for nothing if you don't follow the instructions in the Appendix below exactly.

This is because the JavaDoc utility does not operate on all the folders in your project, but only on the folders and subfolders that you have selected at the time you run the utility. So if you click on a class and then execute the JavaDoc utility, you will only generate JavaDoc for the methods and constructors in that class-and nothing else. And you will get ‘0' for your documentation, regardless of how detailed the description of your code was inside each class since you are marked for the JavaDoc output only.

Attachment:- Object Oriented Programming.rar

Reference no: EM132402872

Questions Cloud

Construct a portfolio of real-world stocks : Is it possible to construct a portfolio of real-world stocks that has a required return equal tothe risk-free rate? Explain.
Discuss the biology behind the problem selected : Individual papers-The paper is to be between 300-550 words. Paper must include the scope of a mental health problem. Discuss the biology behind the problem.
Sinking fund to hold annual payments : If a Bond Indenture requires establishing a Sinking Fund to hold annual payments, then the risk of default on the bond issue is what?
Recruitment system with open internal recruitment system : Compare and contract a closed internal recruitment system with an open internal recruitment system.
CST8284 Object Oriented Programming Assignment : CST8284 Object Oriented Programming (Java) Assignment Help and Solution, Algonquin College - Homework Help - features to your Appointment Scheduler
What you have learned in the class as a researcher : As a public safety manager, you have been assigned to review the failed emergency plan (or lack thereof) from the fire at the Arkema plant. Your investigation.
What is human resource management : What is Human Resource Management? Does a small sole proprietor company need HM?
What are the stages of corporation life cycle : What are the stages of a corporation's life cycle? How can a corporation's life cycle be extended? What stage is your company in?
What is the value of the call option using the two-state : a) What is the value of the call option using the T wo-State Option Pricing Model if the exercise price is $90?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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