Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/****************************************************************/ /* MovieTree Definition */ /****************************************************************/ /* LEAVE THIS FILE AS IS! DO NOT MODIFY ANYTHING! =] */ /****************************************************************/ #pragma once #include // MovieNode: node

/****************************************************************/ /* MovieTree Definition */ /****************************************************************/ /* LEAVE THIS FILE AS IS! DO NOT MODIFY ANYTHING! =] */ /****************************************************************/

#pragma once

#include

// MovieNode: node struct that will be stored in the MovieTree BST

struct MovieNode { int ranking; // Rank of the movie std::string title; // Title of the movie int year; // Year this movie was released float rating; // IMDB rating

MovieNode *parent = nullptr; // Pointer to the parent node MovieNode *leftChild = nullptr; // Pointer to the leftchild MovieNode *rightChild = nullptr; // Pointer to the rightChild

// default constructor MovieNode(){} // Parametrized constructor MovieNode(int r, std::string t, int y, float q) : ranking(r), title(t), year(y), rating(q) {} };

// Class for storing and manipulating a tree of MovieNode's class MovieTree { public: // Check writeup for detailed function descriptions MovieTree(); ~MovieTree(); void printMovieInventory(); void addMovieNode(int ranking, std::string title, int year, float rating); void findMovie(std::string title); void queryMovies(float rating, int year); void averageRating(); private: MovieNode *search(std::string title); // Pointer to the root node MovieNode *root; };image text in transcribed

Test functions please. I have a second part to this also. Will give thumbs up right away!

No additional helper methods. I have other functions to be implemented, but as far as now I just need to follow the write up as it is.Thanks

-MovieTree0 Destructor: Free all memory that was allocated MovieNode "search(string title) This private function is meant to be a helper function. Return a pointer to the node with the given title, or nullptr if no such movie exists void printMovielnventory) Print every node in the tree in alphabetical order of titles using the following format / for every Movie node (m) in the tree cout ==' string:compare() function etc. You may assume that no two movies have the same title void findMovie(string title) Find the movie with the given title, then print out its information: cout ranking title year rating ==' string:compare() function etc. You may assume that no two movies have the same title void findMovie(string title) Find the movie with the given title, then print out its information: cout ranking title year rating

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

25 Vba Macros For Data Analysis In Microsoft Excel

Authors: Klemens Nguyen

1st Edition

B0CNSXYMTC, 979-8868455629

More Books

Students also viewed these Databases questions

Question

Describe the social tasks and challenges of adolescence.

Answered: 1 week ago

Question

Enhance the personal website by adding the image gallery to a page.

Answered: 1 week ago

Question

Does it use a maximum of two typefaces or fonts?

Answered: 1 week ago