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, 23.06.2019 06:10
The head restraint should be adjusted so that it reaches a.the top of your ears b.the base of your skull c.the top of the head
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
How should you specify box sizes on a web page if you want the boxes to vary according to the font size of the text they contain? a. in pixels b. in inches c. as percentages d. in em units
Answers: 2
question
Computers and Technology, 24.06.2019 07:20
3pointsyou've found an image you want to insert into your slide presentation. youwant to make the image look more gray so that it looks like an older imagewhat would you need to adjust? 0.00o a. sizeo b. hueo c. contrasto d. tones
Answers: 2
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
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, 17.01.2020 06:31
question
Social Studies, 17.01.2020 06:31
question
Mathematics, 17.01.2020 06:31
Questions on the website: 13722363