Question: Please make sure I need table.t File also you will have to create tableSpecificOps 1 . cpp and table.cpp as well. Please I need Full
Please make sure I need table.t File also you will have to create tableSpecificOpscpp and table.cpp as well. Please I need Full program code which shown as work perfectly Use the given code and use your edit code run it successfully and send to me all code that you use on your program. Thank you so much Question:Design a table ADT Specifically write a table class.
It must be generic ie templated and contain all the necessary attributes and actions data members and member functions for the table class to behave as expected. you must write a table.t file that works for the provided files:
tableSpecificOpsh table.h pair.h pair.cpp driver.cpp you will have to create tableSpecificOpscpp and table.cpp as well this is "tableSpecificOpsh #include "table.h
#ifndef TABLESPCIFICH
#define TABLESPCIFICH
int f char c;
int f double d; #endif NEXT This is "table.h you may have add base code on this file : #ifndef TABLEH
#define TABLEH
#include
#include "pair.h Pair class
implements a tabke containing keyvalue pairs.
a table does not contain multiple copies of the same item.
types T and Key must have a default constructor
template class Key, typename T
class Table
public:
typedef Key keytype;
for convenience
private:
table implemented using a one dimensional array of keyvalue pairs
int tableSize;
Pair keytype, T thetable;
int Mapping Key k;
Mapping is a function which maps keys to
an array index; ie a key to address mapping
the idea is that Mapping will act on a given key
in such a way as to return the relative postion
in the sequence at which we expect to find the key
Mapping will be used in the remove, add, lookup.
member functions and copy constructor
public:
for debugging
void print;
Table int n int map Key k;
map is a function to map key to address
in the implementation
set the function ie have the code line
Mapping map;
populates table with default values
for the class Key and T
bool insert Pair Key, T kvpair ;
return true if item could be added to the
table false if item was not added.
bool remove const Key aKey ;
erase the keyvalue pair with the specified key
from the table and return if successful
removed item is replaced with default
values for Key and T
T lookUp const Key aKey ;
what if key not in table??
need copy constructor
Table const Table Key, T &initTable ;
need destructor
~Table;
need assignment operator
Table Key, T &operatorconst Table Key, T &initTable ;
;
#include "table.t
#endif NEXT this is another header file given named as "pair.h #ifndef PAIRH
#define PAIRH
more or less from STL library
found in and
template class T class T
class Pair
public:
T first;
T second;
default constructor
Pair: first T second T
constructor that initializes first and second
Pair const T v const T v:
firstv secondv
copy constructor
template typename U typename U
Pair const Pair& X
: first Xfirst second Xsecond
overload
template typename U typename U
Pair& operator const Pair& init
return this Pairinit;
overload
friend bool operator const Pair& lhs const Pair& rhs
return lhsfirst rhsfirst rhsfirst lhsfirst && lhssecond rhssecond ;
overload
friend bool operator const Pair& lhs const Pair& rhs
return lhsfirst rhsfirst && lhssecond rhssecond ;
;
template class T class T
Pair makePair const T& v const T& v
return Pair T Tvv;
#endif Finaly The "Driver.cpp screenshot bellow ww
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
