Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

File Name Description List.h HashTable.h Templated List class Templated List class Patients.cpp Application program using one set of the above classes Patients.csv Data file of

File Name

Description

List.h

HashTable.h

Templated List class

Templated List class

Patients.cpp

Application program using one set of the above classes

Patients.csvimage text in transcribedimage text in transcribed

Data file of patients for the assignment

Purpose

This assignment requires that you to develop a program using the classes listed above. Specifically you will build a hash table containing patient data. The collision strategy will be to build linked lists as the array elements.

Program Specifications

Follow all style requirements from the Webster University Programming Guidelines. A copy of the guidelines can be found on the Connections Portal in the StudentFiles1.zip file. Your program will read the data from the file named Patients.csv attached here. Each record contains 5 fields separated by a comma. They are:

Fields

Data Type

ID

Integer

Name

String

Diagnosis

String

Insurance Company

String

Current Balance

Double

Your application program will read each record, create a Patient structure instance and place that structure instance into the hash table.

You will need to modify the appropriate code to provide for an audit trail of the hash table construction. To accomplish this, you will use cout statements in the above class member functions. You will need to modify them to include couts, but the modifications will be relatively small. If not, you are doing it wrong. The hashing algorithm to use is:

Index = int ( 0.618033 * ID) % size

Make the array size a named constant and set it to 6.

Include a counter for the number of collisions that occurred in building the hash table. Including a static variable in the LinkedList or List class is the best method for doing that.

See the sample audit trail below for the first 5 records on Patients.csv file and the size of the hash table set to 3. This is shown for illustration only. The full file will have different locations calculated.

1122-John Smith Appendicitis Blue Cross 1200.15 is being added

The location is 3

There was no collision loading 1122-John Smith Appendicitis Blue Cross 1200.15

------------------------------------------------

2240-Mary Jones Diabetes Blue Cross 300.25 is being added

The location is 4

There was no collision loading 2240-Mary Jones Diabetes Blue Cross 300.25

------------------------------------------------

2342-Sam Walls Flu Aetna 150.23 is being added

The location is 1

There was no collision loading 2342-Sam Walls Flu Aetna 150.23

------------------------------------------------

3111-Alex Ford Concussion Essence 430.23 is being added

The location is 2

There was no collision loading 3111-Alex Ford Concussion Essence 430.23

------------------------------------------------

3420-June Johnson Breast Cancer Cigna 754.36 is being added

The location is 1

There was a collision loading 3420-June Johnson Breast Cancer Cigna 754.36

It collided with 2342-Sam Walls Flu Aetna 150.23

------------------------------------------------

The number of collisions is 1

After the above is displayed, prompt the user to enter the ID of a patient to locate. Produce an audit trail when locating the requested patient as shown below: Make sure you list all patients that have collided at the hashed location even if the patient is not actually found. That may also cause you to modify one of the existing ADTs a little.

Enter a patient ID to locate (0 to end): 3420

-----------------------------------------------

Will search for 3420

The location is 1

There was a collision here with 3420-June Johnson Breast Cancer Cigna 754.36

There was a collision here with 2342-Sam Walls Flu Aetna 150.23

retrieved from hash table: 3420-June Johnson Breast Cancer Cigna 754.36

-----------------------------------------------

Enter a patient ID to locate (0 to end): 1111

-----------------------------------------------

Will search for 1111

The location is 2

There was a collision here with 3111-Alex Ford Concussion Essence 430.23

Could not find 1111

-----------------------------------------------

Enter a patient ID to locate (0 to end): 0

The number of collisions is 1

Press any key to continue . . .

BELOW IS WHAT PATIENTS.CSV has!

image text in transcribed

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago