Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

implementing this function for me. void rentMovie(std::string title); 2. rentMovie method: When the user calls this method you need to update the quantity in stock

implementing this function for me. void rentMovie(std::string title);

2. rentMovie method: When the user calls this method you need to update the quantity in stock property of the movie, then display the new information about the movie. If the movie is not found, your program should display, Movie not found. If the movie is found in the tree but the quantity is zero, display Movie out of stock.. Information about the movie rented should be printed from within the rentMovie method.

Rent a movie menu option: When the user selects this option, they should be prompted for the name of the movie. This title should then be used to call the rentMovie() method.

hpp file :

#ifndef MOVIETREE_HPP #define MOVIETREE_HPP

#include

/* MovieNode: Node object to store in * the binary search tree (BST). Each movie's * info will be stored in one node. */ class MovieNode { public: // instance variables int ranking; std::string title; int year; int quantity; MovieNode *leftChild; MovieNode *rightChild;

// constructors MovieNode() { ranking = -1; year = 0; quantity = -1; leftChild = rightChild = nullptr; }; MovieNode(int in_ranking, std::string in_title, int in_year, int in_quantity) { ranking = in_ranking; title = in_title; year = in_year; quantity = in_quantity; leftChild = rightChild = nullptr; }

};

/* MovieTree: Class implementing the BST: * - You will implement the methods marked TODO. * - Root of tree is pointed at by 'root' */ class MovieTree { private: // instance var pointing to root node in tree MovieNode* root;

public: // Constructor (TODO) MovieTree();

// Destructor (TODO) ~MovieTree();

// Descr: see 'print the entire inventory' // in the homework manual. (TODO) void printMovieInventory();

// Descr: add movie to BST, at spot in tree // alphabetically-sorted by title. (TODO) // param rating: IMDB rating of movie // param title: title of movie // param releaseYear: release year of movie // param quantity: # of copies available to rent void addMovieNode(int ranking, std::string title, int releaseYear, int quantity);

// Descr: Search the BST for the given title and // print that movie's info in the predefined // format. See 'Find a movie' in the manual. (TODO) // param title: title of node to find void findMovie(std::string title);

// Descr: update the inventory to indicate a movie // has been rented and print predefined info. // See 'Rent a movie' in the manual. (TODO) // param title: title of node to rent void rentMovie(std::string title); };

#endif // MOVIETREE_HPP

parent node is not defined in hpp, dont give me the answer with it.

Thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

What is job rotation ?

Answered: 1 week ago