Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class UnSortedArray { } class SortedArray { } class UnSortedOptimizedArray ( ) My question is what to put in these 3 classes??? ASSIGNMENT 2 Design

image text in transcribed

class UnSortedArray

{

}

class SortedArray

{

}

class UnSortedOptimizedArray

(

)

My question is what to put in these 3 classes???

ASSIGNMENT 2 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 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 Design the following 3 classes for Array-Based structures: 1. a class called UnsortedArray (class file name UnsortedArray.java) that implements an expanded version of an unsorted array class, 2. a class called SortedArray (class file name SortedArray.java) that implements an expanded version of a sorted array class 3. a class called Unsorted OptimizedArray (class file name Unsorted OptimizedArray.java) that implements an expanded version of an unsorted- optimized array class All the classes should have the following exact fields/data members/attributes and methods/operations in this order: Field/Method Field/Method Field/Method Description UnsortedArray SortedArray UnsortedOptimizedArray Data Data Data This field holds the array of contacts Size Size Size This field holds the size of the array Next Next Next This field holds the number of the next contact in the array UnsortedArray SortedArray Unsorted OptimizedArray This constructor initializes the fields with empty/default values Insert Insert Insert This method inserts a contact in the array Delete Delete Delete This method deletes a contact from the array Fetch Fetch Fetch This method fetches a contact from the array Update Update Update This method updates a contact in the array Output Output Output This method outputs all the contacts from the array to the console Finally, once you have designed the 4 classes, design a program/project/driver class called Your Name Assignment2; replace Your Name with your actual name (class file name Your Name Assignment2.java), add the Contact, UnsortedArray, SortedArray, and Unsorted OptimizedArray classes to the project. Then, inside the driver class main method, add code to: 1. Create 2 objects for the Contact class called MyContact and MyContact2 and add your choice of values/data to the objects using the Contact constructor 2. Create 2 more objects for the Contact class called MyContact3 and MyContact4 and add your choice of values/data to the objects using Input methods 3. Use the Output methods to output the 4 contacts 4. Create an object for each of the UnsortedArray, SortedArray, and UnsortedOptimizedArray classes and call them MyUnsortedArray, MySortedArray, and MyUnsortedOptimizedArray (i.e. the 3 array-based objects) 5. Use the Insert methods to insert all 4 MyContact objects into each of the 3 array-based objects 6. Use the Output methods to print all the contacts in each one of the 3 array-based objects 7. Use the Fetch methods to fetch the contact number 3 from all the 3 array-based objects, output the fetched contact using its output method 8. Use the Update methods to update the contact number 1 with new values (your choice) in all 3 array-based objects and output the 3 array- based objects 9. Use the Delete methods to delete contact number 2 from all 3 array-based objects and output the 3 array-based objects ASSIGNMENT 2 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 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 Design the following 3 classes for Array-Based structures: 1. a class called UnsortedArray (class file name UnsortedArray.java) that implements an expanded version of an unsorted array class, 2. a class called SortedArray (class file name SortedArray.java) that implements an expanded version of a sorted array class 3. a class called Unsorted OptimizedArray (class file name Unsorted OptimizedArray.java) that implements an expanded version of an unsorted- optimized array class All the classes should have the following exact fields/data members/attributes and methods/operations in this order: Field/Method Field/Method Field/Method Description UnsortedArray SortedArray UnsortedOptimizedArray Data Data Data This field holds the array of contacts Size Size Size This field holds the size of the array Next Next Next This field holds the number of the next contact in the array UnsortedArray SortedArray Unsorted OptimizedArray This constructor initializes the fields with empty/default values Insert Insert Insert This method inserts a contact in the array Delete Delete Delete This method deletes a contact from the array Fetch Fetch Fetch This method fetches a contact from the array Update Update Update This method updates a contact in the array Output Output Output This method outputs all the contacts from the array to the console Finally, once you have designed the 4 classes, design a program/project/driver class called Your Name Assignment2; replace Your Name with your actual name (class file name Your Name Assignment2.java), add the Contact, UnsortedArray, SortedArray, and Unsorted OptimizedArray classes to the project. Then, inside the driver class main method, add code to: 1. Create 2 objects for the Contact class called MyContact and MyContact2 and add your choice of values/data to the objects using the Contact constructor 2. Create 2 more objects for the Contact class called MyContact3 and MyContact4 and add your choice of values/data to the objects using Input methods 3. Use the Output methods to output the 4 contacts 4. Create an object for each of the UnsortedArray, SortedArray, and UnsortedOptimizedArray classes and call them MyUnsortedArray, MySortedArray, and MyUnsortedOptimizedArray (i.e. the 3 array-based objects) 5. Use the Insert methods to insert all 4 MyContact objects into each of the 3 array-based objects 6. Use the Output methods to print all the contacts in each one of the 3 array-based objects 7. Use the Fetch methods to fetch the contact number 3 from all the 3 array-based objects, output the fetched contact using its output method 8. Use the Update methods to update the contact number 1 with new values (your choice) in all 3 array-based objects and output the 3 array- based objects 9. Use the Delete methods to delete contact number 2 from all 3 array-based objects and output the 3 array-based objects

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

Students also viewed these Databases questions