Order Now  +1 678 648 4277 

Data Structures and Analysis of Algorithms Assignment Help

Stay ahead of your mates by taking our data structures and analysis of algorithms assignment help. Our skillful C++ programming homework tutors will make sure that you never miss a deadline and your assignment is of the highest quality. Our main priority is to save you from stress that comes with writing C++ assignments. If you need data structures and analysis of algorithms homework help, do not hesitate to get in touch with us.

Table Of Contents
  • A Membership Directory for BEAM
  • Implementing A Text-based Interface
  • Using the Tokenizer Class
  • Code Solution

A Membership Directory for BEAM

Objectives
• To strengthen student’s knowledge of C++ programming
• To give student experience reading and parsing strings of commands
• To give student experience in writing Data Structures for data types
Instructions
For this assignment you must write a program that implements a membership directory for the BINGO Enthusiasts Association of Mississippi (BEAM). The membership directory should be implemented as a Binary Search Tree. The directory should be able to create/delete member accounts, edit a member’s information, search for a specific member, display a list of members, and output list of members and their information to a file in post-order (the file format is described below).
Every entry in the membership directory should have the following properties: a member account name (one word), the member’s first, last, and middle names, the number of games won, and the number of games lost. Use the account name to sort the BST.

Implementing A Text-based Interface

Your program should implement a text-based interface capable of handling the following commands:
exit – exits the program
load - parses the contents of the file as if they were entered from the command line
save - saves the contents of the membership directory into the specified file using the format described below; output the information in post-order
directory – displays a list of member account names; use an inorder traversal
display – displays the information for the given member
clear – clears the membership directory; this sets the BST to empty.
add - adds a new member to the directory; create the member with default information and the specified account name
set name - set the member’s name to last, first middle. Last and first name is required, the middle name is optional.
set wins - set member’s wins to wins.
set losses - set member’s losses to losses.
remove - remove the specified member.
The save file should have the following format:
# of Entries
Member Account Name 1
Last, First Middle
Wins Losses
Member Account Name 2
Last, First Middle
Wins Losses
Member Account Name 3
Last, First Middle
Wins Losses

Using the Tokenizer Class

Use the Tokenizer class you developed, or the one I have provided to assist in processing the commands from the text-based interface.
Header Comment
At the top of each program, type in the following comment:
/*
Student Name:
Student NetID:
Compiler Used:
Program Description:
*/
Example:
/*
Student Name: John Smith
Student NetID: jjjs123
Compiler Used: Eclipse using MinGW
Program Description:
This program prints lots and lots of strings!!
*/

Code Solution

/*
Student Name: John Smith
Student NetID: jjjs123
Compiler Used: Visual Studio C++
Program Description: This program manages members using a binary search tree data structure
*/
#include
#include
#include "Tokenizer.h"
#include "Member.h"
#include "MembersBST.h"
using std::cout;
using std::cin;
using std::string;
// Entry point of the program
int main()
{
 MembersBST members;
 Tokenizer tokenizer;
 Member member;
 string filename;
 while (true)
 {
  cout << "Command > ";
  string line;
  getline(cin, line);
  // Check if terminating
  if (line == "exit")
   break;
  if (line == "directory") {
   members.printInOrder();
   continue;
  }
  if (line == "clear") {
   members.clear();
   cout << "Members cleared." << endl;
   continue;
  }
  // Check for command with required arguments
  tokenizer.setString(line);
  string command;
  if (!tokenizer.readWord(command))
   continue;
  if (command == "load" && tokenizer.readWord(filename))
  {
   // Load from file
   if (members.load(filename))
    cout << "Members loaded from file." << endl;
   else
    cout << "Error: The file is invalid." << endl;
   continue;
  }
  if (command == "save" && tokenizer.readWord(filename))
  {
   // Save to file
   members.save(filename);
   cout << "Members saved to file." << endl;
   continue;
  }
  if (command == "display" && tokenizer.readWord(member.accountName))
  {
   // Search and display a member
   if (members.searchMember(member))
   {
    cout << "Account Name: " << member.accountName << endl;
    cout << "Name: " << member.lastName << ", " << member.firstName << " " << member.middleName << endl;
    cout << "Wins: " << member.wins << endl;
    cout << "Losses: " << member.losses << endl;
    cout << endl;
   }
   else
   {
    cout << "Error: Member not found." << endl;
   }
   continue;
  }
  if (command == "add" && tokenizer.readWord(member.accountName))
  {
   // Set other properties to default
   member.firstName = "";
   member.lastName = "";
   member.middleName = "";
   member.wins = 0;
   member.losses = 0;
   if (members.addMember(member))
    cout << "Member added." << endl;
   else
    cout << "Error: Account name already exists." << endl;
   continue;
  }
  if (command == "remove" && tokenizer.readWord(member.accountName))
  {
   // Remove a member
   if (members.removeMember(member.accountName))
    cout << "Member removed." << endl;
   else
    cout << "Error: Member does not exist." << endl;
   continue;
  }
  if (command == "set" && tokenizer.readWord(member.accountName))
  {
   string setMode;
   member.middleName = "";
   member.wins = 0;
   member.losses = 0;
   if (!tokenizer.readWord(setMode))
    continue;
   if (setMode == "name")
   {
    // Update name information
    if (!tokenizer.readWord(member.lastName))
    {
     cout << "Error: A last name is required." << endl;
     continue;
    }
    if (!tokenizer.readWord(member.firstName))
    {
     cout << "Error: A first name is required." << endl;
     continue;
    }
    tokenizer.readWord(member.middleName);
    if (members.setMemberName(member.accountName,
     member.lastName, member.firstName, member.middleName))
     cout << "Member name updated." << endl;
    else
     cout << "Error: Member does not exist." << endl;
    continue;
   }
   if (setMode == "wins")
   {
    // Update wins information
    if (!tokenizer.readInteger(member.wins))
    {
     cout << "Error: A win count is required." << endl;
     continue;
    }
    if (members.setMemberWins(member.accountName, member.wins))
     cout << "Member wins updated." << endl;
    else
     cout << "Error: Member does not exist." << endl;
    continue;
   }
   if (setMode == "losses")
   {
    // Update the losses information
    if (!tokenizer.readInteger(member.losses))
    {
     cout << "Error: A loss count is required." << endl;
     continue;
    }
    if (members.setMemberLosses(member.accountName, member.losses))
     cout << "Member losses updated." << endl;
    else
     cout << "Error: Member does not exist." << endl;
    continue;
   }
   continue;
  }
 }
 return 0;
}