Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have to do this problem using Eclipse and programming in java. The products.tx

ID: 3796613 • Letter: I

Question

I have to do this problem using Eclipse and programming in java. The products.txt file link (will be linked throughout this question) must be used to complete this problem along with Product.java class andInventory.java class (down below)

Products.txt file link: https://www.scribd.com/document/339971410/Products-txt

Inventory.java:

public class Inventory {
  
   private Product [ ] inventory;               // array of Product
   private int capacity;                       // capacity of array
   private int size;                           // number of elements used
  
   public Inventory ( )                       // POST: empty inventory with capacity 100
   {  
   }
  
   public Inventory (int cap)                   // PRE: cap > 0
   {                                           // POST: empty inventory with capacity cap
      
   }
  
   public int getSize( )                        // POST: return number of elements
   {  
   }
      
   public Product getProduct (int index)       // PRE: 0 <= index < size
   {                                           // POST: return Product at index
   }

   public void setProduct (Product p, int index)   // PRE: 0 <= index < size
   {                                               // POST: set Product at index
   }
  
   public void insert (Product p)               // POST: value is added to array
   {      
   }

   public int sequentialSearch (String model)          
   // POST: return index of first occurrence of model id, else -1
   // examine array elements sequentially and return index
   {                                              
   }
  
   public int binarySearch (String model)              
   // PRE: inventory is sorted by product model id
   // POST: return index of first occurrence of model id in inventory
   // return negative value if not found, which is insert location
   // uses binary search algorithm
   {                  
   }                                              
  
   public void selectionSort ( )               // POST: inventory is sorted by ascending model id          
   {                                             // uses selection sort algorithm
   }

   private void resize ( )                       // POST: inventory is doubled in capacity
   {  
   }
  
   private void swap (int mindex, int index)   // POST: products at indexes are exchanged
   {  
   }
  
}

Product.java:

public class Product {
  
   private String category;                   // category (ex. Microscopes)          
   private String model;                       // unique model number (ex. 490620)
   private String description;                   // text description
   private int quantity;                       // quantity on hand
   private int [ ] history;                   // 12 month history of number sold last year starting in Jan
  
   public Product ( )                           // POST: empty product
   {   category = new String ();
       model = new String ();
       description = new String ();
       quantity = 0;
       history = new int [12];
   }

   // accessors and mutators
   public String getCategory()
   {   return category;   }

   public void setCategory(String category)
   {   this.category = category;   }

   public String getModel()
   {   return model;   }

   public void setModel(String model)
   {   this.model = model;   }

   public String getDescription()
   {   return description;    }

   public void setDescription(String description)
   {   this.description = description;   }

   public int getQuantity()
   {   return quantity;   }

   public void setQuantity(int quantity)
   {   this.quantity = quantity;   }

   public int [] getHistory( )           
   {   return history;    }                  

   public void setHistory(int [] history)   
   {   this.history = history;                      
   }
  
   public String toString ()                       // POST: return data member in blank separated string
   {   String result = category + " " + model + " " + description + " " + quantity + " ";
       for (int k=0; k<12; k++)
           result = result.concat(history[k] + " ");
       return result;
   }

}

Part (80 pts This program produce inventory reports for a company. Input file products.tx on First will format. This file was Class contains a list of information (comma separated value) written from a product such as Excel or database management software where one record is placed per line and are separated by Do not edit the data The first line of the file contains the first commas. f day of the month Category ll product category Model ll model id string Description ll text description of product Quantity ll quantity on hand in inventory on first of month ll number sold each month of previous year in order: Jan, Feb, History Sloan.txt Notepad File Edit Format View Help 02/05/2017 De siccators,490620, 2 cubic foot plastic dessicator cabinet. 85,59,924,627,680,788,392, 197,525, 98,852, 646, 201 Bath, 490184, 260010 refrigerated bench top bath with Pelletier thermoelectric cooling from ambient to 40C.,93,605,838,997,418,639,479,94,493,258,48,701,204 Spectrophotometers ,490780, 6 uv/vis spectrophotometer with computer monitor and printer. 8,812,535,367,616,985,566,85, 396,437,5,522,9 28 Centrifuges, 490432, centrifuge.,94,352,112,957,648,120,770,202,67,992,885,364,238 Glove Boxes,490700, stainless steel 2-sided glove box with dual column gas dryer. 3 vacuum pumps and 2 recirculating chillers. Factory reconditioned. ,60,710,728,644,824,499, 267,882,63, 369,678, 66 7, 818 Bath,490174, tissue float bath., 48,59,796,429,438,911,163,582, 38, 329, 892,92, 968 Microscopes, 490727, trinocular compound microscope with 4x 40x and 100x objectives. 14,138,345,949,311,137,715,994, 741, 260, 360,438,988 Cell Disrupters,490292,(Thermal Spectronic) French Press complete with FA-030 cell (40 000 lbs) and rapid-fill kit accessory .,20,131,168,378,484,176,586,319,968,4 30, 225, 347, 199

Explanation / Answer

A)

public class ProductItem {
private int productid;
private int productquantity;
private String productdesc;

public ProductItem()
{
productid=0;
productquantity=0;
productdesc="No description given";
}
public ProductItem(int id, int quantity, String desc)
{
productid=id;
productquantity=quantity;
productdesc=desc;
}
public void setid (int newid)
{productid=newid;}
public void setquantity (int newquantity)
{productquantity=newquantity;}
public void setdesc (String newdesc)
{productdesc=newdesc;}
public int getid()
{return productid;}
public int getquantity()
{return productquantity;}
public void outputid()
{System.out.println("Product Id: " + productid);}
public void outputquantity()
{System.out.println("Product Quantity: " + productquantity);}
public void outputdesc()
{System.out.println("Product Description: " + productdesc);}

}