Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CpE 207L-Data Structures Lab Lab Project Due March 4th, 2021 In this project, you will use Hash table to store the shipments information for a

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
CpE 207L-Data Structures Lab Lab Project Due March 4th, 2021 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 shipment Number 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(): private int size: // Hash table 1/ Hash table size CpE 207L: Data Structures Lab Fall 2020/2021 Methods: public Shipping Service(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(Shipments) 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. 3) Class Shipping Test In the main method, create an object of class Shipping Service with size = 13. Display a menu of choices, as shown in the sample output. Add your sample output as a comment at the end of the test class. Add comments before each method 4. Print the customers names in a specific area 5. Exit 3 Enter the area: hawali The number of shipments in hawali = 1 Choose: 1. Insert shipments 2. Print all shipments 3. Count the shipments in a specific area 4. Print the customers names in a specific area 5. Exit 4 Enter the area: kaifan Ahmad Fatma Choose: 1. Insert shipments 2. Print all shipments 3. Count the shipments in a specific area 4. Print the customers names in a specific area 5. Exit 4 Enter the area: Khaldiya Aisha Choose: 1. Insert shipments 2. Print all shipments 3. Count the shipments in a specific area 4. Print the customers names in a specific area 5. Exit 5 Ahmad 11111111 995 Kaifan_33_13 Fatma 33333333 305 Khaldiya_2_2_20 Aisha 22222222 820 Hawali_5_5_15 Ali 55555555 450 Salmiya_7_7_17 Sara 77777777 750 Q Choose: 1. Insert shipments 2. Print all shipments 3. Count the shipments in a specific area 4. Print the customers names in a specific area 5. Exit 2 Shipping Address Customer Name Customer Number Shipment number Salmiya_77_17 Sara 77777777 750 Kaifan_1_1_12 Ahmad 11111111 905 Kaifan_3_3_13 Fatma 33333333 305 Khaldiya_2_2_20 Aisha 22222222 820 Hawali_5_5_15 Ali 55555555 450 Choose: 1. Insert shipments 2. Print all shipments 3. Count the shipments in a specific area 4. Print the customers names in a specific area 5. Exit 3 Enter the area: Kaifan The number of shipments in Kaifan = 2 Choose: 1. Insert shipments 2. Print all shipments 3. Count the shipments in a specific area

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

What are the determinants of cash cycle ? Explain

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago