QuestionQuestion

For this assignment you are to complete a program that maintains a database of elements from the Person class.

The main program and the Person class supplied to you and is completely written. You are not allowed to make any changes to it.

You are responsible for complete the ClassDataArray class. The definition of the class and it\'s framework has been started and supplied to you. You are to complete the methods such that when you run the program it produces the same output that is shown below. You are not allowed to add or delete any methods. You are also not allowed to change the signatures of any methods. Just write your solutions in the commented out areas in the given file.

These are the methods that you must implement:

the constructor: Creates an object from the Person class.

find(): Looks for a person in the database. If the person is found return the person (object). Otherwise return null.

insert(): If there is space in the database insert and display the lastname, firstname and age of the person and adjust the total count of people. Insertion should occur in the first available space. Otherwise, it prints an error message.

delete(): If the person is in the database , it deletes and displays that person and adjusts the total count of people. Otherwise, it prints an error message.

displayAll(): Displays all the lastname, firstname and age of each of the people and the total count of people currently in the database.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class ClassDataApp {

    public static void main(String[] args) {
       int maxSize = 5;
       ClassDataArray array = new ClassDataArray(maxSize);
       array.insert("Evans", "Patti", 24);
       array.insert("Smith", "Lorraine", 37);
       array.insert("Yee", "Tom", 43);
       array.displayAll();
       array.insert("Adams", "Henry", 63);
       array.insert("Hashimoto", "Sato", 21);
       array.delete("Yee");
       array.displayAll();
       array.insert("Stimson", "Henry", 29);
       array.insert("Velasquez", "Jose", 73);
       array.displayAll();
       array.delete("Stimson");
       array.delete("Hashimoto");
       array.delete("Adams");
       array.delete("Smith");
       array.delete("Evans");
       array.displayAll();
       array.delete("LaMarque");
       array.insert("LaMarque", "Bruno", 54);
       array.insert("Vang", "Minh", 22);
       array.delete("Louie");
       array.insert("Creswell", "Lucinda", 18);
       array.delete("Evans");
       ifFound(array.find("Creswell"));
       ifFound(array.find("Louie"));
    }

    public static void ifFound(Person person) {
       if (person == null) {
            System.out.println("The person was not found in the database.");
       } else {
            System.out.print("Found: ");
            person.displayPerson();
       }
    }

}

class Person {...
$18.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats