subject

Created a fully templatized map: It should have two template variables, one for the key and one for the data. I am referring to them as KEY and DATA both here and in the starting code. This can just be two parallel arrays, one for the keys and one for the data. Create a constant k_max to indicate the maximum # of data entries in your map. k_max should be between 5 and 2000. Small is perfectly fine. The following methods must exist for this map:
A default constructor. This constructor zeros any indexes and then stops.
A find function that returns the index where the KEY is found. You will need create the find function first before you do the insert function below. You should use the == operator to determine if it's found.
An insert function that takes a KEY and a DATA.; This function will not insert if the map is full or the key already exists. It will print an error message. This function will print what it is trying to insert.
A constructor that takes a single KEY and a single DATA. It should initialize the index to zero and then call the insert function for that key and data.
A function that loops through the map and prints it.
All the code needs to be in the .h. Only do one-line methods in the interface and larger functions in the .h but separate from the interface. (Note: functions with loops should never be inline, even if you could squish them into one line.
// CST136_4_93.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include
#include
using std::string;
// I have a standardized to-do where I ask you to create a variable using your
// template class. It is:
// todo: VAR {variable name} : KEY -> datatype, DATA -> datatype
// ie VAR: {solar} - KEY -> string, DATA -> int
// which means: create a map variable "solar" that takes the key that is a string
// and data that is an int
void test_insert();
void test_my_class();
int main()
{
std::cout << "Start Student Tests" << std::endl;
// you can add your own tests between this start and stop.
std::cout << "END Student Tests" << std::endl;
std::cout << "START testing" << std::endl;
test_insert();
test_my_class();
std::cout << "END testing" << std::endl;
}
void test_insert()
{
std::cout << std::endl;
uncomment this when you are ready and follow the instruction
todo: var: {solar} - key -> string, data -> int
create a map variable "solar" that takes the key that is a string and data that is an int
// solar; // update this line to make your variable "solar" as described above.
std::cout << "start test_insert" << std::endl;
don't change these lines other then to uncomment them.
std::cout << " test: single, not duplicate, inserts without issue." << std::endl;
// solar. insert("moon", 238900);
// solar. insert("mars", 33900000);
// solar. insert("leo satellite", 1200);
std::cout << " END: Single, not duplicate, inserts" << std::endl;
std::cout << " TEST: print";
std::cout << " Should print all three entries." << std::endl;
// solar. print();
std::cout << " END: print" << std::endl;
std::cout << " TEST: Duplicate insert of Moon" << std::endl;
std::cout << " Note: Produces an error message within the insert" << std::endl;
// solar. insert("moon", 238900);
std::cout << " END: Duplicate insert of Moon" << std::endl;
std::cout << "END test_insert" << std::endl;
}
void test_my_class()
{
std::cout << std::endl;
std::cout << "START test_insert_my_class()" << std::endl;
todo: VAR {intkey} - : KEY -> int , DATA -> your class
std::cout << " TEST: Insert of your Class as DATA" << std::endl;
Uncomment the loop below. (Don't change it after)
//for (int i = 0; i < k_max; i++)
// intkey. insert(i, test[i]);
//intkey. print();
leave this loop alone
std::cout << " END: Insert of your Class as DATA" << std::endl;
todo: VAR {classkey} - : KEY -> your class , DATA -> int
Uncomment the loop below. (Don't change it after)
std::cout << " TEST: Insert of your Class as KEY" << std::endl;
//for (int i = 0; i < k_max; i++)
// classkey. insert(test[i], i);
// // note: this also tests your overloaded << operator.
//classkey. print();
std::cout << " END: Insert of your Class as KEY" << std::endl;
leave this loop alone
std::cout << " TEST: Duplicate / Full Insert" << std::endl;
Note: this also tests your overloaded == operator. :)
you will get either a full error or a duplicate error. Doesn't matter which.
//classkey. insert(test[0], 0);
std::cout << " END: Duplicate Insert" << std::endl;
std::cout << "END test_insert_my_class()" << std::endl;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Match the steps of the process to julia's analysis. 1. analyze choices. current costs for making phone calls to foreign countries averages between five and ten cents a minute. 2. determine the goals. julia needs to reduce the cost of telecommunications without reducing her employees' ability to do their jobs. 3. gather data. the corporate computer network will be able to handle the increased traffic that will occur as a result of voip. 4. evaluate the decision. julia will have her it department set up voip in the smallest domestic office. 5. make the decision. julia will have employees document the benefits and problems that result from using the new technology.
Answers: 1
question
Computers and Technology, 22.06.2019 14:10
Dean wants a quick way to look up staff members by their staff id. in cell q3, nest the existing vlookup function in an iferror function. if the vlookup function returns an error result, the text “invalid staff id” should be displayed by the formula. (hint: you can test that this formula is working by changing the value in cell q2 to 0, but remember to set the value of cell q2 back to 1036 when the testing is complete.)
Answers: 3
question
Computers and Technology, 24.06.2019 12:30
Do you think media is stereotype ? and why?
Answers: 1
question
Computers and Technology, 25.06.2019 02:00
Software and services are used to conceive, plan, and execute projects in any field. these tools are excellent methods of increasing the probability of successful projects. open source linux project management mind-mapping
Answers: 2
You know the right answer?
Created a fully templatized map: It should have two template variables, one for the key and one for...
Questions
question
Mathematics, 05.08.2020 05:01
question
Mathematics, 05.08.2020 05:01
question
Mathematics, 05.08.2020 05:01
question
Mathematics, 05.08.2020 05:01
question
English, 05.08.2020 05:01
Questions on the website: 13722363