Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Contact Class is already created, but I attached a picture of what it holds Rear Design a class called Queue (class java file name Queue.java)

Contact Class is already created, but I attached a picture of what it holds

image text in transcribed

image text in transcribed

Rear Design a class called Queue (class java file name Queue.java) that encodes an expanded version of a queue class, with the following exact' fields/data members/attributes and methods/operations in this order: Field/Method Description Data This field holds the data, an array of Contacts Size This field holds the size (maximum number of nodes) of the queue Front This field holds the position of the front of the queue This field holds the position of the rear of the queue Queue This constructor with no parameters initializes the fields of the queue Queue This constructor creates a queue of a size given by the parameter Enque This method inserts the node (given by the parameter) to the queue Deque This method fetches and deletes a node from the queue and returns it Output This method outputs all the values from the queue This met Empty This method reinitializes the queue to the empty queue IsEmpty This method tests if the queue is empty (underflow condition) Peek This method peeks at the queue (look at the first position) and outputs it Find This method finds a contact in the queue (receives the contact name as a parameter), outputs the contact and returns the position (or - 1 if not in the queue) Design a class called Stack (the class java file name Stack.java) that encodes an expanded version of a stack class, with the following exact fields/data members/attributes and methods/operations in this order: Field/Method Data Top Size Stack Stack Push Pop Output Empty IsEmpty Peek Find Description This field holds the data, an array of Contacts This field holds the top of the stack This field holds the size of the stack This constructor with no parameters initializes the fields of the stack This constructor creates a stack of a size given by the parameter This method inserts the node (given by the parameter) to the Stack This method fetches and deletes a node from the stack and returns it This method outputs all the values from the stack This method reinitializes the stack to the empty stack This method tests if the stack is empty (underflow condition) This method peeks at the stack (look at the first position) and outputs it This method finds a contact in the stack (receives the contact name as a parameter), outputs the contact and returns the position (or - 1 if not in the queue) Finally, once you have designed the 2 classes (Queue and Stack), design a program/project/driver class called Your NameAssignment3; replace YourName with your actual name (class file name Your NameAssignment2.java), add the Contact, Queue, and Stack classes to the project. Then, inside the driver class main method, add code to create 3 objects of each of the classes Queue and Stack (MyQueuel, MyQueue2, MyQueue3, MyStack1, MyStack2, and MyStack3) using different constructors and demonstrate the functionality of all the methods from the 2 classes (i.e use all the methods and output the structures or returned values after each operation to show the functionality). Contact Class Design a class called Contact (the class file should be called Contact.java) that implements a contact listings class, with the following exact. fields/data members/attributes and methods/operations in this order: Field/Method Description Name This field holds the name of the contact Address This field holds the physical address of the contact Phone This field holds the phone number of the contact Email This field holds the email address of the contact Contact uer received a parameters This constructor creates a contact with the 4 values received as parameters Input This method inputs a contact (the 4 values for the 4 fields) from the console Output This method outputs the contact (the 4 fields) to the console ToString This method serializes the contact into a string: NAME=Name, ADDRESS=Address, PHONE=Phone, EMAIL=Email DeepCopy This method creates and returns a deep copy of the contact Compare This method compares 2 contacts and returns true if they are equal (same name) and false if not Update | This method updates the fields with the values received from parameters

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

4. What actions should Bouleau & Huntley take now?

Answered: 1 week ago