Program Specification

Problem Description The goal of this assignment is help you brush up your C++ programming skills, and exercise your skills in data structure and algorithm design (the stuff that you know from CS 367). In this assignment you are to develop a " word locator " program written in C++, which will allow a user to check if a specified (re)occurrence of a specified query word appears in the input text file. Your program must be named " wl ". When started, your program will display a prompt " > " (printed on stdout/cout) and will then be ready to accept one of the following commands: 1. " load <filename> " : This command loads the specified file. The file may be specified by either an absolute or a relative pathname. Running this command should result in your program parsing and storing the words in this file in a data structure that can be queried using the locate command (described below). A word is defined as a sequence of upper and lower case letters in the English alphabet (i.e. characters 'a' to 'z', and 'A' to 'Z'), numbers, and the apostrophe. All other characters are considered as white space and will therefore be treated as terminating a word. Two successive load commands should be treated as if there is an intermediate " new " command (see below) in between the two commands. 2. " locate <word> <n> " : This command outputs the number of the word, counting from the beginning of the file, of the n th occurrence of the word. Word numbering starts from 1, so the first word in the load file has a word number of 1. The locate command is case insensitive, i.e. to match the word in the locate command with a word in the load file you should use a case-insensitive string comparison method. If there are no matches for the locate command, print " No matching entry ". The syntax of the locate command is " locate <word> <n> ". The " <word> " parameter will have a whitespace before and after it, and " <n> " should be an integer greater than 0. As an example, the following are legal locate commands: " locate sing 3 " and " locate sing 3 " Both locate the 3 rd occurrence of " sing " , but the second command has a few …