Make a UML Class Diagram
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <cctype>
#include <cstring>
#include <string>
#include <iomanip>
#include <ctime>
#include <limits>
#include "HashTable.h"
#pragma warning(disable : 4996)
using namespace std;
typedef HashTable<string>::Iterator iterDec;
const char* DELIMITERS = " ,.-\':;?()+*/\\%$#!\"@\^&";
const int TABLE_SIZE = 29990;
int Spell_Check(HashTable<string>& hashTable, string word);
void Print_Table_Stats(HashTable<string>& hashTable);
string To_Lower_Case(string word);
int main()
{
string filename;
cout << "Enter the file name: ";
cin >> filename;
int result = 0;
string userInput;
string currWord;
clock_t beg;
clock_t end;
char response;
ifstream infile;
HashTable<string> hashTable(TABLE_SIZE);
infile.open(filename);
if (infile.fail())
{
cout << "**FATAL ERROR - Sorry the dictionary file inputed by you could not be found...\n";
exit(1);
}
cerr << "PLEASE WAIT Dictionary is loading........\n";
beg = clock();
while (infile >> currWord)
{
if (!hashTable.Count(currWord))
{
hashTable.Insert(currWord);
}
}
infile.close();
end = clock() - beg;
cout << "Your Dictionary has been loaded in: " <<
(double)end / ((double)CLOCKS_PER_SEC) << " secs!";
cout << endl;
cout.fill('-');
cout << left << setw(50) << "" << endl;
do {
cout << "Please enter Sentence/Words: ";
getline(cin, userInput);
cout << endl;
char* splitInput = strtok(const_cast<char*>(userInput.c_str()), DELIMITERS);
while (splitInput != NULL)
{
currWord = splitInput;
currWord = To_Lower_Case(currWord);
result += Spell_Check(hashTable, currWord);
splitInput = strtok(NULL, DELIMITERS);
}
if (result > 0)
{
cout << "Number of Words Spelled Incorrectly: " << result << endl;
result = 0;
}
cout << "Do you want to enter a Sentence/Words? (y/quit): ";
cin >> response;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
} while (toupper(response) == 'Y');
cout << "BYE The Dictionary Exits!!\n";
return 0;
}
int Spell_Check(HashTable<string>& hashTable, string word)
{
int result = 0;
int suggestions = 0;
string remove[256];
int numRemove = 0;
if (!hashTable.Count(word))
{
++result;
cout << "** " << word << ": ";
for (unsigned x = 0; x < word.length(); ++x)
{
string alteration = word;
for (char c = 'a'; c <= 'z'; ++c)
{
alteration[x] = c;
if (hashTable.Count(alteration))
{
cout << alteration << ", ";
remove[numRemove++] = alteration;
++suggestions;
hashTable.Remove(alteration);
}
string insertion = word.substr(0, x) + c + word.substr(x);
if (hashTable.Count(insertion))
{
cout << insertion << ", ";
remove[numRemove++] = insertion;
++suggestions;
hashTable.Remove(insertion);
}
}
}
for (unsigned c = 0; c < word.length() - 1; ++c)
{
string transposition = word.substr(0, c) + word[c + 1] + word[c] + word.substr(c + 2);
if (hashTable.Count(transposition))
{
cout << transposition << ", ";
remove[numRemove++] = transposition;
++suggestions;
hashTable.Remove(transposition);
}
string deletion = word.substr(0, c) + word.substr(c + 1);
if (hashTable.Count(deletion))
{
cout << deletion << ", ";
remove[numRemove++] = deletion;
++suggestions;
hashTable.Remove(deletion);
}
}
while (numRemove >= 0)
{
hashTable.Insert(remove[numRemove--]);
}
if (suggestions< 1)
{
cout << "Sorry No spelling suggestion found...";
}
cout << endl << endl;
}
return result;
}
string To_Lower_Case(string word)
{
for (unsigned c = 0; c < word.length(); ++c)
{
word[c] = tolower(word[c]);
}
return word;
}
I have created the UML using ArrayList. All you need to do is replce Array List with hashtable as per the needs of your code.

Make a UML Class Diagram #include "stdafx.h" #include <iostream> #include <fstream> #include <cctype> #include <cstring> #include...