Microsoft Word - Assign1_2021.docx
University of Newcastle
School of Electrical Engineering and Computing
SENG1110/6110 Programming Assignment 1 – Semester 1, 2021
Due: By electronic submission (Blackboard) by 11:59pm on Fri, 30/04.
VET CLINIC MANAGMENT
Introduction
The objective of this assignment is to implement an object-oriented program using Java, to manage doctors and pets in
a vet clinic. Assignment 2 will be an extension of this assignment.
SENG1110 students - This assignment can be completed in pairs.
SENG6110 students - This assignment must be completed individually.
Before you start
Carefully read the specification below. Make sure you have all the information necessary to start writing the program. If
you are uncertain of something, do not make assumptions. Post your questions to the discussion board forum named
"assignment 1" and check it regularly.
Try to start the assignment as soon as possible. There is a document “HelpToStartAssign1” and some Java files on
Blackboard, which you can use as a starting point.
Specification
The program will keep track of up to 2 doctors, and up to 4 pets.
When run, the program will display a menu of actions to the user, including one that exits the program. Until the user
chooses to exit, the menu is displayed again after each action is completed.
The program must have the following functionalities:
1 The user may enter a new doctor into the vet clinic. The user will input the name and specialisation. If a
doctor with the same name already exists, or the specialisation is invalid, or the doctor limit has been reached,
the program should output an e
or message.
2 The user may enter a new pet into the vet clinic. The user will input the name, type, size, weight, and age. If a
pet with the same name already exists, or an invalid value is given, or the pet limit has been reached, the
program should output an e
or message.
3 The user may delete a doctor from the vet clinic. The user will input the name of the doctor. If the doctor does
not exist, the program should output an e
or message. Before deletion, all pets that are assigned to the
specified doctor should have their 'doctor' instance variable updated to "No doctor assigned".
4 The user may delete a pet from the vet clinic. The user will input the name of the pet. If the pet does not exist,
the program should output an e
or message.
5 The user may request a list of doctors in the vet clinic with all the information of each doctor. Normally, one
line should be output for each doctor, with the form: Doctor
: specialist. If there
are no doctors, the program should output the message "No doctors".
6 The user may request a list of pets in the vet clinic with all the information of each pet. Normally, one line
should be output for each pet, with the form: Pet : weighing kg at
AGE> years old (). If there are no pets, the program should output the message "No pets".
7 The user may request a list of pets assigned to a specific doctor. The user will input the name of the doctor.
Normally, one line should be output for each pet, similarly to above. If there are no doctors, the program should
output "No doctors". If the named doctor does not exist, the program should output "No doctor with that name".
Otherwise, if the doctor has no assigned pets, the program should output "No assigned pets".
8 The user may assign a doctor to a pet. The user will input the name of the pet and the name of the doctor. If
the pet or doctor do not exist, or the pet is already assigned to that doctor, or the doctor does not have the right
specialisation, the program will output an e
or message. If the pet is already assigned to another doctor, the
program should ask the user to confirm that they would like to change the assigned doctor.
9 The user may analyse a pet. The user will input the name of the pet and the program will output an indication
of whether the pet is overweight.
A cat is considered overweight if it is:
• Small with weight greater than 4kg
• Medium with weight greater than 6kg
• Large with weight greater than 8kg
A dog is considered overweight if it is:
• Small with weight greater than 6kg
• Medium with weight greater than 9kg
• Large with weight greater than 12kg
If the pet does not exist, the program will output an e
or message.
Doctor and pet names should be converted to lowercase after input. For example, if the user inputs "Benny", the
program should convert it to "benny".
Program Requirements:
Your program should consist of three classes, with these names and instance variables:
• Doctor – stores the following details about a doctor.
o name – String – the name of the doctor. Should not contain spaces.
o specialisation – String – the specialisation of the doctor. Must be "dog" or "cat".
• Pet – stores the following details about a pet.
o name – String – the name of the pet. Should not contain spaces.
o type – String – the type of the pet. Must be "cat" or "dog".
o size – String – the size of the pet. Must be "small", "medium" or "large".
o weight – double – the weight of the pet. Must be positive.
o age – int – the age of the pet. Must be positive.
o doctor – String – the doctor of the pet. Should initially be "no doctor assigned".
• Clinic – provides information for all doctors and pets in the clinic.
o doctor1, doctor2 – Doctor – up to two doctors.
o pet1, pet2, pet3, pet4 – Pet – up to four pets.
All instance variables of your classes need to be private (this is imposed so that you apply the principles of
encapsulation).
Your classes will need methods to provide the required functionalities. The only class which should have a main
method is Clinic.java, which should create an instance of the class Clinic, and call a method run(), which will display
the menu to the user. This class will be the only one that takes input from and sends output to the user. It may do so
using either TIO or GUI methods (your choice). A template is shown below.
public class Clinic {
private void run(){
...
}
public static void main(String[] args){
Clinic c = new Clinic();
c.run();
}
}
You must not use a
ays in this assignment.
Marks will be awarded for layout (including visual aspects (variable names, indentation) and structural aspects
(variable scope, method usage)), documentation (comments), and the submission's ability to perform as specified. A
more detailed marking schema is available on Blackboard.
What to submit
You should submit only the three .java files (Doctor.java, Pet.java, Clinic.java), in a compressed .zip file, via the
"Assignment 1" link on Blackboard. Do not include .class files in your submission.
Add your student name(s) on the top of each Java file submitted. If you are completing the assignment as a group
(only SENG1110 students), add both names in each Java file AND submit 2 assignment cover sheets.
Extra Work for SENG6110 students
You need to provide a UML class diagram of your program. Extra material, including lecture slides and a video are
available in Blackboard.
Late Penalty and adverse circumstances
Note that your mark will be reduced by 10% for each day (or part day) that the assignment is late. This applies equally
to week and weekend days. You are entitled to apply for special consideration if adverse circumstances have had an
impact on your performance in an assessment item. This includes applying for an extension of time to complete an
assessment item. See https:
www.newcastle.edu.au/cu
ent-students/learning/assessments-and-exams/adverse-
circumstances for more details.
Prof Regina Be
etta - 2021
Microsoft Word - Assign1_2021MarkingSchema (edited).docx
SENG1110/6110 - semester XXXXXXXXXXAssignment 1 Marking Schema
ID: Name: Marker:
Inco
ect file name /-2 each Pet Class
Class not submitted /-20 each Instance variables /private /2
Compiles /-3 each Methods /6
Run /-3 each General class design/organisation /4
Functionality Clinic Class
Add docto
check /4 Instance variables /private /2
Add pet/check /5 Methods