BTE324/ – Object Oriented Programming
SPRING2020
Assignment #2
Due 2/15/2020
A patient scheduling system is used by hospitals and doctor’s offices tomanage patient appointments.
Your task is to design and implement adata model using Javaclasses that is to beused to hold the data
necessary for patient scheduling.
To test this data model, create a Java class called SchedulePatientsTest that will do the
following:
a) The base package forall your Java classesshouldbe edu.miami.bte324.XXXX,where
XXXX isyour username without the dot,i.e.,j.doe’spackageshouldbe
edu.miami.bte324.jdoe.
b) Copythe following code intothe class SchedulePatientsTest:
private String[] patientNames = { "John Lennon", "Paul McCartney", "George
Harrison", "Ringo Starr" };
private String[] patientEmails = { "jlennon@beatles.com",
"pmccartney@another.edu", "george@something.com", "drummer@beatles.org" };
private String[] patientSSN = { "123-45-6789", "333-22-1123", "567-39-9282",
"888-88-8888" };
private String[] patientBirthDates = { "05/01/1951", "06/23/1964",
"09/05/1955", "02/28/2001" };
private String[] doctorNames = {"John Smith", "Jane Doe", "Mary Jones", "Beth
Garcia" };
private String[] doctorEmails = { "jsmith@doc.com", "jdoe@doc.com",
"mjones@doc.com", "bgarcia@doc.com" };
private String[] doctorSSN = { "445-25-3382", "582-10-9983", "180-38-0038",
"343-34-9875" };
private String[] doctorBirthDates = { "06/03/1941", "10/10/1950",
"12/25/1965", "07/19/1964" };
c) Create a Patient class and aDoctor class to represent patients and doctors, respectively. Make
sure to createthe appropriate fields required for each. Consider using either
java.util.Date or java.util.Calendar to represent the dates (rather than using
Strings).
d) Instantiateeitheran array or a java.util.List of Patient objects and anarray or a
java.util.List of Doctor objects and fill theseobjects with the data in thearraysabove.
e) Create an enumeration listing medical specialties. IncludeGENERAL_MEDICINE, PEDIATRICS, and
ONCOLOGY as members of this enumeration. Then add a field in the Doctor object to allowyou
to assign doctors to the following specialties: John Smith toGENERAL_MEDICINE, Jane Doe to
PEDIATRICS, Mary Jones to GENERAL_MEDICINE, and Beth Garcia to ONCOLOGY.
BTE324– Object Oriented Programming
f) Create anarray or a java.util.List with entries for the following upcoming visits:
Patient Doctor Date
John Lennon John Smith 11Mar 2018
John Lennon John Smith 11Apr 2018
Ringo Starr Jane Doe 25Mar 2018
Jane Doe John Smith 11Mar 2018
PaulMcCartney Mary Jones 09Apr 2018
George Harrison Beth Garcia 09Apr 2018
(note that a doctor canalso bea patient!)
g) List all upcoming visits tothe console output in the following format:
Visit date:
Doctor:
Specialty:
March 11, 2018
John Smith
GENERAL_MEDICINE
Days until visit: (Number)
Patient:
First name: George
Last name: Harrison
email: george@something.com
SSN: 567-39-9282
Age: 57
h) Writeout aline separator using
System.out.println(“------------------------------------------“);
Then, list all upcoming visits by doctor, only for doctors with the specialty of
GENERAL_MEDICINE,to the console output, in the followingformat:
Doctor: John Smith
Specialty: GENERAL_MEDICINE
Upcoming visits:
Visit date:
First name:
Last name:
email:
2018/03/11
George
Harrison
george@something.com
SSN: 567-39-9282
Age: 57
Leaveablank line between visits.
i) Writeout aline separator using
System.out.println(“------------------------------------------“);
Then, list all upcoming visits by patient, only for patientsthat actuallyhave anupcoming visit, to
the consoleoutput, in the following format:
BTE324 – Object Oriented Programming
Patient Name: Harrison, George
email: george@something.com
SSN: 567-39-9282
Age: 57
Upcoming visits:
Visit date:
Doctor:
Specialty:
11 March 2018
John Smith
GENERAL_MEDICINE
Leaveablank line between visits.
Notes and hints:
1. The “Days until visit” field should put the number ofdays from thecurrent date(the dateat
which the program is run) and the datein which the visit is scheduled tooccur.You are
expected to use either java.util.Date or java.util.Calendar forthe
calculations.
2. Make sure you format the dates as indicated in the samples above. Use the class
java.util.SimpleDateFormat forthis formatting.
3. The output is expected as shown, with the values aligned. Use tabs in yourprint commands.
You may find it easier to use the System.out.printf command to format the output.
Submission guidelines:
Zipallclassesunderthesrc/main/javafolderofyourproject(i.e.,your.javafiles).Namethezipfile
bte324.hw1.XXXX.zip,whereXXXXstandsforyourusernamewithouttheperiod(i.e.,j.doeshouldname
his/herzip file bte324.hw1.jdoe.zip).SubmitthroughBlackboard.
Make sure to move any classes from thesrc/test/java folder (for test classes) to your src/main/java
folder if you wish tosubmit them. Make sure to include the whole package structure (which is reflected
as a directory structure under Eclipse). Do NOT include your target folder (i.e.,.class files). Make sure to
put your name on all Java classes (Hint: use the“Generate Element Comment” option from Eclipse over
the class declaration, you will get an @author annotation where you caninsert your name).
Gradingand Due date:
The homework is due Sept 30/2015 before11:59 pm. Youwill lose 25% of your grade for every day that
the assignment submission is delayed beyond thedue date. After4 days, you will receiveno credit for
the assignment.
50% of your grade will depend on the program running asrequired. The remaining 50% will be assigned
based on the way in which programs are coded. Programs that work but do not use all required classes
and good programming practices willsee grades being deducted. Programs thatdo notwork can still
receivea gradebased on codingpractice.
As I indicated in class, please make sure you modularize your code and organize it (use functions - don't
turn in a 300 lines of code all in main(). Also, try to account for future expansions of your program - be
forward looking in the way you design this. Please turn in a 1-2 pages report (LATEX format) that defines
the problem, requirements, specifications, and how you designed your system and structured your
program. We will add to this report and define use cases, and state diagrams in the next project, but you
could add this now if you would like. You should definitely add a conclusion.
版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。