-
Notifications
You must be signed in to change notification settings - Fork 1
Pet Module Documentation
The pets.cpp and pets.hpp files form the Pet Management module of the Veterinary Management System (VMS). This module handles all operations related to pet records, including creation, viewing, updating, deletion, search, filtering, and import/export.
• pets.cpp: Implements the logic for all pet-related operations.
• pets.hpp: Declares function prototypes and includes necessary headers.
Goal: Create a function to display the Pet Menu and connect the file with the system. Explanation: This sets up the user interface portion of the pet module. It ensures users can access pet functions from the menu.
Goal: Allow users to input new pet details and insert them into the database.
Explanation: Gathers user input for name, breed, age, etc., and uses VMSDatabase::addRecord() to store it.
Goal: Display all pets stored in the database.
Explanation: Uses VMSDatabase::printTable() to show the entire pet table.
Goal: Enable the deletion of a pet record by Pet ID.
Explanation: Prompts user for Pet ID and removes the entry using VMSDatabase::deleteRecord().
Goal: Allow the user to update existing pet records.
Explanation: Pulls all pets using getData(), finds the right one by ID, and prompts for updated fields before calling addRecord().
Goal: Search for a pet based on Pet ID.
Explanation: Iterates over the result of getData("pets") to find and display the correct record.
Goal: Allow exporting pet data to a CSV file and importing from a CSV file. Explanation: Uses file streams to write all records to a file or load them into the database.
void addPet();
void viewPet();
void updatePet();
void removePet();
void viewAppointmentHistory();
void savePetsToFile();
void loadPetsFromFile();
• Includes <iostream>, <vector>, <string>, <fstream>, and your vms_database.hpp.
• Uses #pragma once to prevent duplicate inclusions.
The pet menu is integrated with main.cpp using a simple switch-based loop that allows the user to access it from the main dashboard. Once selected, displayPetMenu() is launched, which loops until the user exits.
• All database interaction is handled via the VMSDatabase class.
• All user input is validated with basic type checking.
• CSV export is written in plain text with , delimiters.
By Luke Pring and Jack Turner for the Software Development 2 module at University of Roehampton, London.