Computer Science work essay

Computer Science
Price: $10 USD

Question description

Problem: Appointments

Write a Java class named

representing appointments you make. You will be

modeling the equivalent of a real world appointment using Java.

This class should include several pieces of data as instance variables:

day of the week: (integer with 0 representing Sunday and 6 representing Saturday)

who the appointment is with (String)

duration of the appointment (double)

start time of the appointment (double with 0.0 representing midnight, 12.0 representing noon, and

(for example) 15.0 representing 3pm. For this assignment, you can assume all appointments

begin either on the hour or on the half-hour.)

The Appointment class will have several methods

get/set methods for each instance variable (all of which should be declared private).

getDay, setDay

getPerson, setPerson

getDuration, setDuration

getStartTime, setStartTime

3 constructors: a default constructor with no parameters, a constructor with 4 parameters (day,

start time, duration, and person

in that order

), and a copy constructor which makes a new object

from the current state of another object (passed as a parameter).



method. As discussed in class, this method is very useful for working with (and

debugging!) objects and object variables. It should return a reasonable representation of the

object based on the instance variable values, but the exact format of that String is up to you.

the method


which takes a new start time and a new duration and updates the current


the method


which takes an Appointment object as a parameter. This function

returns a boolean value based on whether or not the current appointment and the parameter

variable appointment conflict with each other. For the purposes of this assignment, a conflict is

defined as two appointments on the same day of the week whose times overlap by some amount.

Testing your solution:

You will need to write a class, say

, which instantiates (creates) a

number of Appointment object variables and tests your functions above. How you write this file

is entirely up to you, as it is strictly for your own testing purposes.

Tutor Answer

(Top Tutor) Daniel C.
School: Boston College
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1824 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors