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, 22.06.2019 23:30
Define a function printfeetinchshort, with int parameters numfeet and numinches, that prints using ' and " shorthand. ex: printfeetinchshort(5, 8) prints: 5' 8"
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
Where can page numbers appear? check all that apply. in the header inside tables in the footer at the bottom of columns at the top of columns
Answers: 1
You know the right answer?
In this assignment you will modify the program written in the previous assignment (bribe program) to...
Questions
question
Mathematics, 23.10.2021 19:40
Questions on the website: 13722359