Question
Ask any questions in the comments! The original product class is also below! Thank you so much. class Product { private String name; private String
Ask any questions in the comments! The original product class is also below! Thank you so much.
class Product {
private String name;
private String description;
private int price;
//--------------------------------------------------------------
public Product(String name_, String description_, int price_) {
// constructor
name = name_;
description = description_;
price = price_;
}
//--------------------------------------------------------------
public void displayProduct() {
System.out.print(" Product name: " + name);
System.out.print(", Description: " + description);
System.out.println(", Price: " + price);
}
//--------------------------------------------------------------
public String getName() // get name of product
{
return name;
}
} // end class Product
You are given a Product class in the second page. Just like the arrays of primitive types in Java like(int arrays, float arrays, etc.) create your own data structure called ProductArray without using ArrayList. This ProductArray data structure needs to have: A constructor which sets the size of array. A search function which returns Product. An insert function. A delete function. A display function. Since this will be your data structure you need to cover the critical parts in this data structure. For example, if the array is full then you can't add any more item. Think about the critical parts and cover them. After you created your ProductArray data structure, write a class named TestProductArray and do the followings: Create a product array sized 50. Insert 10 items in your array. Display the array. Search for 2 items. (One is in the array and the other one is not) Delete 3 item.(2 of them are in the array and the third one is not) Display the array. Please use short comments in the parts that you seemed necessaryStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started