Computers and Technology
Computers and Technology, 15.11.2019 00:31, tporter00

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;
}
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:00, brylove603
Pls do you believe that the use of 3d animation has grown in feature films over the last few years? if so, do you think the trend will continue? what are the forces driving this trend?
Answers: 2
image
Computers and Technology, 24.06.2019 20:20, isaiahromero15
Write python code that prompts the user to enter his or her favorite color and assigns the user’s input to a variable named color.
Answers: 1
image
Computers and Technology, 25.06.2019 22:00, ava5015
Technician a says that air-conditioning service machines are used exclusively with hfc-134a systems. technician b says that refrigerant containing sealers should be recycled. who is correct?
Answers: 1
image
Computers and Technology, 26.06.2019 02:00, hooplikeapro
From the table style options area of the design tab, you select banded columns. what will happen to your table? a. every other column will have a border added to it. b. every other column will be shaded. c. every other column will be merged with its neighboring column. d. each column will split in half
Answers: 1
Do you know the correct answer?
In this assignment you will modify the program written in the previous assignment (bribe program) to...

Questions in other subjects:

Konu
Biology, 17.11.2020 02:30
Konu
Mathematics, 17.11.2020 02:30
Konu
Mathematics, 17.11.2020 02:30