Question: Java Code In this project, you will use Hash table to store the shipments information for a shipping company. The program allows you to supplement


Java Code
In this project, you will use Hash table to store the shipments information for a shipping company. The program allows you to supplement the company with additional new shipments. The shipment information includes the following: String ShippingAddress Il in this form: area_block_street_house String CustomerName int customerNumber int shipmentNumber where the area is the key of the hash table. You need to write and submit a java program that includes three classes: Shipment.java, Shipping Service.java and ShippingTest.java. 1) Class Shipment Instance variables: private String shippingAddress; private String customerName; private int customerno; private int shipmentNo; Methods: A constructor that initializes the instance variables. Set and get methods for each instance variable. toString method that returns a string containing shippingAddress, customerName, customerNo and shipmentNo. 2) Class Shipping Service Instance variables: private Shipment table(); // Hash table private int size; // Hash table size Methods: public ShippingService(int size) Create an array of shipments and save the size of the hash table. public int hashFun(String address) Split the string address, based on underscore, to get the area. Then, find the summation of characters ASCII values of area and return the hash key. public boolean insert(Shipment s) Insert the shipment s in the proper location and return true. When a collision happens, use linear or quadratic propping. If the hash table is full, return false. public void printTable() Call toString() method and print the contents of the Hash Table as shown in the sample output. public int countArea(String area) Count and return the number of shipments in the given area. public void printCustomers(String area) Print all customers' names in the given area
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
