|
|
| (11 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| − | <br />
| + | ~ Migrated |
| − | ==Project description==
| |
| − | <span style="background:#E6E6FA ">'''In this project, we have created a GUI Java (Swing) Application for a Zoo Management System:'''</span>
| |
| − | * You can try the application by downloading the Java Jar file from this link: http://perso.sinfronteras.ws/images/0/00/SMSimulator.jar
| |
| − | * You can also see or download the Java Project from our Github repository at: https://github.com/adeloaleman/JavaDesktopApp-ZooManagementSystem
| |
| − | * If you just want to take a look to the Application GUI, [[Zoo Management System#A look at the GUI|here]] we show some images that try to describe the most important features of the application.
| |
| − | | |
| − | | |
| − | | |
| − | <span style="background:#E6E6FA ">'''Our Management System allows users (Zoo Administrators) to manage Animals and Zoo Keepers. Some of the functionalities that have been added to the system are:'''</span>
| |
| − | * Search for Animals:
| |
| − | :: Refine by: Type, Specie, Name, etc.
| |
| − | * Search for Keepers
| |
| − | * Add new animals to the database
| |
| − | * Add new keepers
| |
| − | * Update animals
| |
| − | :: Manage aspects such as Medications, Vaccines, Offsprings, etc
| |
| − | * Update keepers
| |
| − | | |
| − | | |
| − | | |
| − | <span style="background:#E6E6FA ">'''The most important concepts we have applied to build this applications are:'''</span>
| |
| − | * '''Design Patters:'''
| |
| − | :* We have implemented a [[Object Orientation with Design Patterns#Model-View-Controller MVC|Model-View-Controller MVC]]
| |
| − | :* To facilitate communication between GUI components we have implemented a [[Object Orientation with Design Patterns#Mediator Pattern|Mediator Pattern]]
| |
| − | * [[Java GUI Programming|GUI Java Swing]]
| |
| − | * [[Object-Oriented Concepts and Constructs#Inheritance|Inheritance]], [[Object-Oriented Concepts and Constructs#Polymorphism|Polymorphism]], [[Object-Oriented Concepts and Constructs#Upcasting - Downcasting|Upcasting - Downcasting]]: These were the most important concepts we have learned and implemented in this project. Because animals are broken down into different types (see example below) we had implemented a class-based inheritance model where <Animal> is the super class. We often had to use Downcasting in order to get access to specific behaviors of a subclass into the Animal hierarchy.
| |
| − | * [[Object-Oriented Concepts and Constructs#Abstraction|Abstraction]]
| |
| − | * [[Object-Oriented Concepts and Constructs#Encapsulation|Encapsulation]]
| |
| − | * [[Object-Oriented Concepts and Constructs#Serialization|Serialization]]: We have implemented data persistence through a file using serialization.
| |
| − | | |
| − | | |
| − | The Zoo has a number of Animals. These Animals are broken down into types: Mammal, Reptile, Avian, Aquatic, Insect. For example:
| |
| − | * Mammal:
| |
| − | :* Avian
| |
| − | ::* Bat
| |
| − | :::* date of birth, date of arrival, fight, gender, ofspring, medication, vaccine, exhibit number
| |
| − | | |
| − | | |
| − | <!--
| |
| − | | |
| − | '''Each Animal has a Zoo keeper that looks afer it:'''
| |
| − | *Zoo keepers are only allowed to care for animals if they are qualified to do so.
| |
| − | *A zoo keeper can look afer a max of 3 Animal types for a max of 10 animals.
| |
| − | | |
| − | | |
| − | | |
| − | '''Your system must be run on test data before the Zoo will accept it.
| |
| − | | |
| − | | |
| − | | |
| − | '''You are required to have a data set of at least 100 animals and 40 zoo keepers.'''
| |
| − | | |
| − | -->
| |
| − | | |
| − | | |
| − | <br />
| |
| − | | |
| − | ==Class diagram==
| |
| − | <div style="text-align: center;">
| |
| − | <figure id="fig:Fake_news_dataset_example">
| |
| − | <pdf width="2000" height="700">File:ClassDiagramCCTZoo.pdf</pdf>
| |
| − | <caption>Data example</caption>
| |
| − | | |
| − | [[File:ClassDiagramCCTZoo.pdf|950px|thumb|center|]] [[File:ClassDiagramCCTZoo.png|950px|thumb|center|]]
| |
| − | </figure>
| |
| − | </div>
| |
| − | | |
| − | | |
| − | <br />
| |
| − | | |
| − | ==An example of one of the classes==
| |
| − | <syntaxhighlight lang="java">
| |
| − | public class Test {
| |
| − |
| |
| − | public static void main(String[] args) {
| |
| − | Cat c = new Cat();
| |
| − | System.out.println(c.health);
| |
| − |
| |
| − | Dog d = new Dog();
| |
| − | System.out.println(d.health);
| |
| − |
| |
| − |
| |
| − | // // Upcasting
| |
| − | Mammal m = c; // Although there's no need to for programmer to upcast manually, it's legal to do so:
| |
| − | // Mammal m = (Mammal) new cat();
| |
| − |
| |
| − | System.out.println(c); // This print: upcastingdowncasting.Cat@15db9742
| |
| − | System.out.println(m); // This will print the same: upcastingdowncasting.Cat@15db9742
| |
| − | // As you can see, Casting does not change the actual object type
| |
| − | // Cat is still exactly the same Cat after upcasting.
| |
| − | // It didn't change to a Mammal, it's just being labelled Mammal right now.
| |
| − | // This is allowed, because Cat is a Mammal.
| |
| − |
| |
| − |
| |
| − | // // Downcasting
| |
| − | if(m instanceof Cat){ // testing if the Animal is a Cat
| |
| − | System.out.println("It's a Cat! Now I can downcast it to a Cat, without a fear of failure.");
| |
| − | Cat c1 = (Cat)m; // Manual downcasting back to a Cat
| |
| − | }
| |
| − |
| |
| − | // The following code will compile, but throws "java.lang.ClassCastException: Mammal cannot be cast to Cat" exception during runTime,
| |
| − | // because I’m trying to cast a Mammal, which is not a Cat, to a Cat.
| |
| − | Mammal m1 = new Mammal();
| |
| − | Cat c2 = (Cat)m1;
| |
| − |
| |
| − | }
| |
| − |
| |
| − | }
| |
| − | </syntaxhighlight>
| |
| − | | |
| − | | |
| − | <br />
| |
| − | ==A look at the GUI==
| |
| − | <gallery mode=packed-overlay>
| |
| − | File:ZooManagementSystem_GUI_1.png|Main Menu
| |
| − | File:ZooManagementSystem_GUI_2.png|View Animals Panel
| |
| − | File:ZooManagementSystem_GUI_3.png|View Animals Panel - Refine by...
| |
| − | File:ZooManagementSystem_GUI_4.png|Add Animals Panel
| |
| − | File:ZooManagementSystem_GUI_5.png|View Keeper Panel - Refine by...
| |
| − | File:ZooManagementSystem_GUI_6.png|Add Zoo Keaper Panel
| |
| − | </gallery>
| |
| − | | |
| − | | |
| − | <!--
| |
| − | [[File:ZooManagementSystem_GUI_1.png|600px|thumb|center|]]
| |
| − | | |
| − | | |
| − | [[File:ZooManagementSystem_GUI_2.png|900px|thumb|center|]]
| |
| − | | |
| − | | |
| − | [[File:ZooManagementSystem_GUI_3.png|900px|thumb|center|]]
| |
| − | | |
| − | | |
| − | [[File:ZooManagementSystem_GUI_4.png|900px|thumb|center|]]
| |
| − | | |
| − | | |
| − | [[File:ZooManagementSystem_GUI_5.png|900px|thumb|center|]]
| |
| − | | |
| − | | |
| − | [[File:ZooManagementSystem_GUI_6.png|600px|thumb|center|]]
| |
| − | -->
| |