Doctor’s Office Booking Software
This assignment is meant to be an exercise in validating user input, performing
string manipulation, and ultimately, further strengthening your OOP
fundamentals. To begin, you will be building an Application in Windows Forms
that will be used to book clients into a doctor’s schedule. Here is a screenshot of
a sample design for the booking software:
User Input Details:
• Patient Name
o Will take a string consisting of the patient’s First Name and Last
Name
• Date of Birth
•
•
•
•
•
•
•
o A DateTimePicker will be used to take input in the form of the
patient’s Date of Birth
o The user must be at least 18 years of age or older. This will be
validated when the user changes the value of the field
Address will take any string (e.g. 108 University Ave)
City will take any string
Province will take any string
Postal code must be given in a valid Postal Code format (e.g. N1C 2B6)
o This validation must be performed using a regex
o This validation will occur when the user changes the value of the
field
Phone number will take exactly 10 digits as entry
o Must not contain any spaces, characters, or special characters
o Must be validated using a regex
o This validation will occur when the user changes the value of the
field
Email will take a string and must be given in a valid email format
o This validation will occur when the user changes the value of the
field
o *Hint* The MailAddress class will throw an error if given an invalid
email address as a parameter in the constructor
Requested Appointment time will utilize a DateTimePicker to allow a user
to select their intended appointment time
o When the user presses Book appointment, the following validation
must be performed on the Requested Appointment time:
▪ The user cannot book an appointment during another patient’s
scheduled appointment time
▪ If the user does try and book an appointment over top of
another patient’s appointment time, an error popup will be
shown as in the screenshots below
o To get a DateTimePicker to show the intended format as in the
screenshot, set the Format property to Custom, and in the
CustomFormat property, set it’s value to “MM/dd/yyyy hh:mm:ss“
• Appointment Duration will have the option for 15 minutes, 30 minutes, 45
minutes, or 1 hour in the ComboBox
• Description will take a string that describes the purpose for the requested
appointment and can be any string
Buttons:
• Book appointment will perform the following operations:
o Check if the requested appointment coincides with an already
scheduled appointment
▪ If it does, show an error popup
o save the user’s appointment
o Present the user with a success message
• Reset Fields will clear all entered fields of their inputs
• Pre-fill fields will fill all user entered fields with correct sample data so the
user knows what is expected
• Print will output all booked appointments to a .txt file at the project’s
directory. The format for the output is outlined further down this
document.
o If there are no appointments to print, a popup will be shown to the
user outlining this
o After printing out all appointments, a success popup will be shown as
in the screenshots below
Design Details:
The purpose of this assignment is to help strengthen your OOP skillset as well as
build on your knowledge of File I/O. As such:
• The entirety of the office will be represented by a single object
o That object can contain as many properties as necessary (e.g.
member variables)
o All operations to be performed that alter the state of the office must
be handled by a method that belongs to the object
▪ E.g. If a user wishes to book an appointment, the Office object
should have a “BookAppointment” method
o All properties of the Office object should be private
• An appointment will also be represented by a single object
o The appointment object will have many properties (such as the user
entered values)
o The appointment object must have a ToString override method that
represents the object in string format
When print is pressed, a file titled “Appointments.txt” should be created in the
project directory that consists of all appointments currently scheduled in the
system. This file will look like this:
Appointments.txt
—————————————————-Patient Name: Bob Ross
Age: 87
Address: 108 University Ave
City: Waterloo
Province: Ontario
Postal Code: N3B 1C5
Phone Number: (519) 748-5220
Email: bRoss@conestogac.on.ca
Appointment time: 02/05/2023 12:15pm
Appointment duration: 30 minutes
Description: This is a test
—————————————————Patient Name: Jim Johnson
Age: 45
Address: 108 University Ave
City: Waterloo
Province: Ontario
Postal Code: N3B 1C5
Phone Number: (519) 748-5220
Email: jJohnson@conestogac.on.ca
Appointment time: 02/05/2023 12:45pm
Appointment duration: 1 hour
Description: This is a test
—————————————————Patient Name: John Doleson
Age: 55
Address: 108 University Ave
City: Waterloo
Province: Ontario
Postal Code: N3B 1C5
Phone Number: (519) 748-5220
Email: jJohnson@conestogac.on.ca
Appointment time: 02/05/2023 1:45pm
Appointment duration: 1 hour
Description: This is a test
—————————————————-
Screenshots:
feature/requirement
All naming conventions are followed for components, methods, variables, etc.
Form contains the required input fields
Buttons “Pre-fill”, “Book appointment”, “Clear” & “Print” perform their respective action
Code contains the required objects
Office object has private member variable Appointments
Office object has a Book Appointment method that ensures appointment time doesn’t conflict with
an already scheduled appointment
Appointment object has member variables for all user-entered inputs
Appointment object has a ToString() override method
Book Appointment button checks if the appointment time/duration coincide with another
Book appointment button shows correct message popups based on if there are errors present or
not, as well as a success popup outlining the appointment time
Print button utilizes a StreamWriter
Print shows correct popups based on how many appointments are scheduled
Print outputs to a Text file called Appointments.txt
Print outputs ALL appointment information and in the correct format
The following are static methods in a separate ValidationHelper class:
IsValidPhoneNumber accepts a string and returns a Boolean
Returns false if the string is null/empty/mismatches; true if whole matches the pattern
Uses a Regex to perform the validation
IsValidPostalCode accepts a string and returns a Boolean
Uses a Regex to perform the validation
Returns false if the string is null/empty/mismatches; true if whole matches the pattern
IsValidEmail accepts a string and returns a Boolean
Utilizes the MailAddress class
IsValidPatientAge accepts a DateTime and returns a Boolean
Returns false if the DateTime is in the future, or if the patient isn’t at least 18 years old
Error messages are displayed in a red label
All errors displayed at once, one line per error
Error messages are reset (or cleared) when the VALUE of the error field is changed to a correct
value
All programs and methods are to have a comment stating WHAT they do,
from a user’s perspective. The generated comments do not suffice.
Naming conventions apply for programs, methods & variables, but not
methods/variables derived from the database.