Get Instant Help From 5000+ Experts For

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
C++ Menu Module Implementation - Menu and MenuItem Classes

Menu Class Implementation

I need help making the Menu.h and Menu.cpp files, note the Menu Tester program can not be edited, also when coding only code what is asked in the Menu module and MenuItme Module, no extra code should be added, when coding the rule of three make sure (Copy constructor and Copy assignment are deleted). example MenuItem(const MenuItem& m) = delete;//Copy constructor MenuItem& operator=(const MenuItem& m) = delete;//Copy assignment Not sure how to make a const char* type conversion. Code done using c++ programming language The Menu Module Create a module called Menu (in files Menu.cpp and Menu.h) this module will hold both MenuItem and Menu Classes' implementation code. Since the Menu class owns its MenuItem objects, it must have full control over the MenuItem creation. To implement this, have the declaration of the MenuItem and Menu class in the following sequence: Forward declare the class Menu in the header file. Implement the MenuItem class declaration (fully private) with Menu class as a friend. (see MenuItem class) Implement the Menu class declaration. (See Menu Class) The MenuItem Class Create a class called MenuItem. This class holds only one Cstring of characters for the content of the menu item dynamically. The length of the content is unknown. This class should be fully private (no public members; even constructor is private!): Make the "Menu" class a friend of this class (which makes MenuItem class only accessible by the Menu class). friend class Menu; Constructor Allocates and sets the content of the MenuItem to a Cstring value at the moment of instantiation (or initialization). If no value is provided for the description at the moment of creation, the MenuItem should be set to an empty state. Rule of Three A MenuItem object cannot be copied from or assigned to another MenuItem object. (Copy constructor and Copy assignment are deleted) -important need to have Destructor Deallocates the content bool type conversion When a MenuItem is casted to "bool" it should return true, if it is not empty and it should return false if it is empty. const char* type conversion When a MenuItem is casted to "const char*" it should return the address of the content Cstring. displaying the MenuItem Create a method to display the content of the MenuItem on ostream. (No newline is printed after) Nothing is printed if MenuItem is empty. Remember that the MenuItem class is fully private. The Menu Class Create the Menu class as follows: Rule of Three A Menu Object can not be copied or assigned to another Menu Object. (Copy constructor and Copy assignment are deleted) Attributes This class has a minimum of three attributes. A MenuItem to possibly hold the title of the Menu. An array of MenuItem pointers. The size of this array is set by a constant unsigned integer defined in the Menu header file; called MAX_MENU_ITEMS. Have the MAX_MENU_ITEMS integer initialized to 20. This array will keep potential MenuItems added to the Menu. Each individual element of this array will hold the address of a dynamically allocated MenuItem as they are added to the Menu. (See insertion operator overload for Menu) Initialize this array of pointers to nullptrs. An integer to keep track of how many MenuItem pointers are pointing to dynamic MenuItem objects. (obviously, the value of this variable is always between 0 and MAX_MENU_ITEMS). Constructors A Menu is always created empty; with no MenuItems, with or without a title. Example: Menu A; Menu B("Lunch Menu"); Destructor Looping through the MenuItems array of pointers, it deletes each pointer up to the number of menu items in the menu. Methods Suggestion: create a function to display the title of the Menu on ostream if the title is not empty, otherwise, it does nothing. Create a function to display the entire Menu on ostream: This function first displays the title (if it is not empty) followed by a ":" and a new-line, then it will display all the MenuItems one by one; adding a row number in front of each. The row numbers are printed in two spaces, right justified followed by a "dash" and a "space". After printing all the MenuItems it should print " 0- Exit" and new-line and "> ". For example if the title is "Lunch Menu" and the menu items are "Omelet", "Tuna Sandwich" and "California Rolls", the Menu object should be printed like this: Lunch Menu: 1- Omelet 2- Tuna Sandwich 3- California Rolls 0- Exit > Create a member function called run. This function displays the Menu and gets the user selection. (this function should be completely foolproof) The function receives nothing and returns an unsigned integer (That is the user's selection). After displaying the menu, ask for an integer and make sure the value of the integer is between 0 and the number of the menu items. If the user enters anything incorrect, print: "Invalid Selection, try again: " and get the integer again until a valid selection is made. Nice to do: The action of a foolproof integer entry within limits, with a prompt and an error message is a good candidate for a separate function implementation in the Utils module Overload operator~ to do exactly what the run function does (two different ways to run the menu) Overload a member insertion operator (operator<<) to add a MenuItem to the Menu. Menu& Menu::operator<<(const char* menuitemConent); This operator receives a C-style string containing the content of the MenuItem and returns the reference of the Menu object (*this). To accomplish this, check if the next spot for a MenuItem is available in the array of MenuItem pointers. If it is, dynamically create a MenuItem out of the content received through the operator argument and then store the address in the available spot and finally increase the number of allocated MenuItem pointers by one. If no spot is available, ( that is; if number of allocated MenuItem pointers is equal to MAX_MENU_ITEMS) this function silently ignores the action. At the end, return the reference of the Menu object. Usage example: int a; Menu M; M << "Omelet" << "Tuna Sandwich" << "California Rolls"; a = cout << "Your selection " << a << endl; output: 1- Omelet 2- Tuna Sandwich 3- California Rolls 0- Exit > 3 Your selection 3 Overload two type conversions for int and unsigned int to return the number of MenuItems on the Menu. Overload the type conversion for bool to return true if the Menu has one or more MenuItems otherwise, false; Overload the insertion operator to print the title of the Menu using cout. Example for the last three overloads: Menu M ("Lunch Menu"); M << "Omelet" << "Tuna Sandwich"

sales chat
sales chat