subject

In this assignment you will modify the program written in the previous assignment (bribe program) to use a binary search tree.

the application will look the same to the user as the application you created for assignment #4, and have the same sample output, with one exception. in assignment #4, if if the user entered a bribe amount that someone already in the list paid, then you "broke the tie" by "first come, first served." however, binary search trees cannot contain duplicate values. therefore, in this assignment, if the user enters a bribe amount that someone already in the list paid, then you will not add a new person to the list. instead, you just will advise the user that this bribe amount has already been paid, after which the application continues by displaying the menu to add, view or exit.

you will be creating a multi-file project with the following three files:

file name purpose
tree. h header file for ctree class
tree. cpp implementation file for ctree class
test. cpp driver file
as with assignment #4, you have been given all the code except for the implementation of the ctree class. the code for the driver file is given below. the accompanying module gives you all the member variables and functions of the ctree class and the member variables and constructor of the personrec structure, so writing the tree. h file should be a no-brainer. your task is to implement, in tree. cpp, the ctree member functions. there also is a powerpoint presentation on recursion that you can download.

note: as with assignment #4, you do not need to do any error checking to determine if the user typed in a legal menu choice (1, 2 or 3), a name, or a positive whole number for a bribe.

same rules as before for turning in your assignment, late assignments, doing your own work, etc.

code for test. cpp file

// test. cpp

#include

using namespace std;
#include
#include "tree. h"

int displaymenu (void);
void processchoice(int, ctree& );

int main (void)
{
int num;

ctree ct;
do
{
num = displaymenu();
if (num ! = 3)
processchoice(num, ct);
} while (num ! = 3);

return 0;
}

int displaymenu (void)
{
int choice;
cout < < "\nmenu\n";
cout < < "\n\n";
cout < < "1. add student to waiting list\n";
cout < < "2. view waiting list\n";
cout < < "3. exit program\n\n";
cout < < " enter choice: ";
cin > > choice;
return choice;
}

void processchoice(int choice, ctree& mytree)
{
switch (choice)
{
case 1: mytree. add (); break;
case 2: mytree. view (); break;
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:30
Ted wants to go out to a neighborhood park and shoot pictures of dew drops on grass. he wants to get a low-level angle of the dew drops. which support equipment should ted use? a. mini tripod b. pistol grip c. monopod d. body mount
Answers: 2
question
Computers and Technology, 22.06.2019 08:30
Active listen eliminates barries to communication true or false
Answers: 1
question
Computers and Technology, 22.06.2019 17:40
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
You know the right answer?
In this assignment you will modify the program written in the previous assignment (bribe program) to...
Questions
Questions on the website: 13722360