×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Create A Program to Create a Vet Clinic System in Java Assignment Solution

July 04, 2024
Jessica Miller
Jessica Miller
🇺🇸 United States
Java
Jessica Miller is a seasoned programmer with a master's degree in software engineering from Stanford University. Having completed over 700 Java assignments, Jessica excels in implementing sorting algorithms, multi-dimensional arrays, and efficient array operations. Her deep understanding of complex programming concepts and hands-on experience make her a valuable resource for students seeking high-quality homework help.
Key Topics
  • Instructions
    • Objective
  • Requirements and Specifications
Tip of the day
Use modular coding in Verilog assignments by breaking the design into smaller modules. This improves readability, simplifies debugging, and allows for easier testing and reuse of code components in larger designs.
News
In 2024, Visual Studio Code now offers enhanced GitHub Copilot integration for faster, while PyCharm has improved debugging and testing tools, making it ideal for Python students​

Instructions

Objective

Write a java assignment program to create a vet clinic system.

Requirements and Specifications

VET CLINIC SYSTEM

  • DATABASE MANAGEMENT SYSTEM
  • METHODS
  • INHERITANCE
  • OOPS IMPLEMENTATION
  • FUNCTIONS

Source Code

public class VetClinic { private static final int COLLECTION_SIZE = 5; private Vet[] vets = new Vet[COLLECTION_SIZE]; /* --------------------------------------------------- --- Create a new VetClinic collection populated --- --- with blank Vet entries --- --------------------------------------------------- */ public VetClinic() { for (int i = 0; i < COLLECTION_SIZE; i++) { this.vets[i] = new Vet(); } } /* ---------------------------------------------------- --- Display the entire VetClinic collection with --- --- one vet per line. Empty entries should not --- --- be printed. --- ---------------------------------------------------- */ public void showVetClinic() { System.out.println("\nMy VetClinic\n-----------------"); for (int i = 0; i < this.vets.length; i++) { if (!this.vets[i].getName().equals("")) System.out.println(this.vets[i]); } System.out.println("-----------------\n"); } /* ----------------------------------------------- --- Add the newVet to the first element in --- --- vets with name = "". Return true if --- --- successful, false otherwise --- ----------------------------------------------- */ public boolean addVet(Vet newVet) { // TO DO: Add code to this method to prevent the same name // being used twice. // If the name already exists in the collection, // false is returned and the collection is not updated int i = 0; while (i < COLLECTION_SIZE && !this.vets[i].getName().equals("")) { if (this.vets[i].getName().equals(newVet.getName())) { return false; } i++; } if (i < COLLECTION_SIZE) { this.vets[i] = newVet; return true; } else return false; } /* ----------------------------------------------------------- --- Update the specialism of the VetClinic item that --- --- matches the name and specialism values of the Vet --- --- passed as a parameter. Return true if successful or --- --- false if a matching vet is not found. --- ----------------------------------------------------------- */ public boolean updateSpecialism(Vet aVet, String newSpecialism) { // TO DO: Provide this method body for (int i = 0; i < this.vets.length; i++) { String name = this.vets[i].getName(); if (name.isEmpty()) { continue; } if (name.equals(aVet.getName())) { this.vets[i].setSpecialism(newSpecialism); return true; } } return false; } /* ---------------------------------------------------------- --- Return the vet names where the vet specialism --- --- matches that passed as a parameter, one title per --- --- or "" if the artist name is not found --- ---------------------------------------------------------- */ public String getVetsBySpecialism(String aSpecialism) { // TO DO: Provide this method body StringBuilder builder = new StringBuilder(""); for (int i = 0; i < this.vets.length; i++) { String name = this.vets[i].getName(); if (name.isEmpty()) { continue; } if (this.vets[i].getSpecialism().equals(aSpecialism)) { if (!builder.toString().isEmpty()) { builder.append(System.lineSeparator()); } builder.append(name); } } return builder.toString(); } /* --------------------------------------------------------- --- Delete the Vet matching the name and specialism --- --- of that passed as a parameter by setting it to an --- --- empty Vet. Return true if successful or false if --- --- the details in the parameter do not match a Vet --- --- in the collection --- --------------------------------------------------------- */ public boolean delete(Vet aVet) { // TO DO: Provide this method body for (int i = 0; i < this.vets.length; i++) { String name = this.vets[i].getName(); if (name.isEmpty()) { continue; } if (this.vets[i].getName().equals(aVet.getName())) { this.vets[i] = new Vet(); return true; } } return false; } /* ------------------------------------------------------------ --- Return true if the VetClinic contains at least three --- --- non-empty Vet objects or false otherwise --- ------------------------------------------------------------ */ public boolean isViable() { // TO DO: Provide this method body int counter = 0; for (int i = 0; i < this.vets.length; i++) { String name = this.vets[i].getName(); if (name.isEmpty()) { continue; } counter++; } return counter >= 3; } }

Similar Samples

Discover our curated collection of programming assignment samples at ProgrammingHomeworkHelp.com. Whether you're delving into Java, Python, C++, or exploring machine learning and web development, our samples offer clear, expertly-crafted solutions. Each example serves as a valuable resource to enhance your understanding and proficiency in programming. Explore and learn with confidence from our diverse range of practical coding solutions.