Question: In this assignment, you will practice utilizing regular expressions. Instructions Assignment Header At the top of each of your C + + programs, you should
In this assignment, you will practice utilizing regular expressions.
Instructions
Assignment Header
At the top of each of your C programs, you should have at least four lines of documentation:
Program name the C file names Author your name Date last updated, and Purpose a brief description of what the program accomplishes Here is an example:
Program name: jbtictactoe.cpp
Author: John Doe
Date last updated:
Purpose: Play the game of TicTacToe
Assignment: Burger Toppings
Create a set class that contains an AVLTree. The set class should be templated. To navigate your set you will need an iterator, so you will be provided with a modified version of the AVLTree that contains an Iterator as a nested class.
You will be given a burger class that contains an enum for the burger toppings. You will need to modify the class so that the burger class contains a set of toppings that uses your custom set class. Add a function that allows a topping to be added to the burger, and change the getToppings function so that it turns all of the toppings in the set into a string. In the main, you will modify the provided code so that the toppings picked by the user will be added to a burger object. The will be limited tests run on this code.
heres burger.cpp
#include "burger.h
burger::burgerint numPatties
setNumPattiesnumPatties;
std::string burger::getToppings
std::string c;
c toppingStrtoppings;
for int i ; i numToppings; i
c toppingStrtoppingsi;
return c;
void burger::setNumPattiesint num
if num
numPatties num;
else
std::cout "The number of patties should be greater than std::endl;
std::string burger::tostring
std::ostringstream out;
out std::setprecision std::fixed std::showpoint;
out "Number of patties: numPatties std::endl;
out "Toppings: getToppings;
return out.str;
heres burger.h
#pragma once
#include
#include
#include
#include
#include
#include
const int TOPNUM ;
enum toppingType
GRILLONION,
RAWONION,
TOMATO,
LETTUCE,
BACON,
MUSHROOM,
PICKLE,
NOTOP
;
const std::string toppingStrGrilled Onion",
"Raw Onion",
"Tomato",
"Lettuce",
"Bacon",
"Grilled Mushroom",
"Pickle",
"None";
const toppingType toppingList
GRILLONION,
RAWONION,
TOMATO,
LETTUCE,
BACON,
MUSHROOM,
PICKLE, NOTOP;
class burger
public:
burgerint numPatties;
std::string getToppings;
void addToppingtoppingType;
std::string tostring;
void setNumPattiesint num;
int getNumPatties const;
private:
toppingType toppings;
make a set int numToppings;
This should come from the set
int numPatties;
;
heres main.cpp
#include
#include
#include
#include
#include "burger.h
void resetStream;
int promptNumPatties;
void promptToppingstoppingType int &;
int main
int pat promptNumPatties;
toppingType top;
int topCount;
promptToppingstop topCount;
burger myBurgerpat;
std::cout myBurger.tostring std::endl;
void resetStream
std::cin.clear;
std::cin.ignorestd::numericlimits::max
;
int promptNumPatties
int pat;
std::cout "How many patties do you want on your burger? ;
std::cin pat;
std::cout std::endl;
if std::cin && pat
return pat;
else if std::cin
resetStream;
std::cout "You entered an invalid amount of patties. Please try again." std::endl;
return promptNumPatties;
void promptToppingstoppingType top int &count
int topInt;
count ;
for int i ; i ; i
std::cout "Please choose a topping from the list. Enter to stop adding toppings." std::endl;
for int i ; i TOPNUM; i
std::cout i : toppingStri std::endl;
std::cin topInt;
std::cout std::endl;
if topInt
break;
while std::cin topInt topInt TOPNUM
if std::cin
resetStream;
std::cout "You did not choose a valid topping. Please try again." std::endl;
std::cin topInt;
std::cout std::endl;
topcount toppingListtopInt ;
if topInt
break;
heres set.h
#ifndef SETH
#define SETH
#include "AVLTree.h
#endif
heres binarysearchtree.h
#ifndef SEARCHH
#define SEARCHH
#include "binaryTree.h
#include
template
class binarySearchTree : public binaryTree
public:
void insertconst t &insertItem;
bool searchconst t &searchItem;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
