Question
C++ ONLY PLEASE. SO HAVING TROUBLE AGAIN. I HAVE A HEADER FILE AND HAVE TO CREATE ANOTHER HEADER FILE AND CALL FUNCTIONS FROM THE FIRST
C++ ONLY PLEASE. SO HAVING TROUBLE AGAIN. I HAVE A HEADER FILE AND HAVE TO CREATE ANOTHER HEADER FILE AND CALL FUNCTIONS FROM THE FIRST HEADER FILE. SEE BELOW:
videogame class
Attributes
- title a pointer to a Text object, which will hold the title of the video game
- platform a pointer to a Text object, which will hold the platforms that the video game is available on
- year an integer representing the year the video game was released
- genre a pointer to a Text object, which will hold the genre of the video game
- ageRating a pointer to a Text object, which will hold the age rating of the video game
- userRating a number between 0 and 100 representing the user rating from IGDB
Functions
Function name: VideoGame constructor
- Parameters:
- A pointer to a Text variable, containing the title of the video game
- A pointer to a Text variable, containing the platform(s) of the video game
- An integer containing the year the video game was released
- A pointer to a Text variable, containing the genre of the video game
- A pointer to a Text variable, containing the age rating of the video game
- A number containing the IGDB (user) rating of the video game (out of 100)
- Purpose: This function should be called when all video game information is known and it will create a new video game with this information.
- Specifications: initialize all attributes to the arguments sent to this function.
Function name: ~VideoGame destructor
- Purpose: This function is automatically called when a Video game object is destroyed. This function releases the dynamically allocated text arrays in the Video game.
- Specifications: Release the dynamically allocated space for the video gameTitle, video gameGenre, and video gameRating.
- Prints a message: VideoGame destructor: Released memory for title, platform, genre, & rating.
Function name: printVideoGameDetails
- Parameters: none
- Returns: none (void)
- Purpose: This function should be called when the user wants to print ALL the video game information to the screen.
- Specifications: Print the title, year, genre, rating & number of stars. Remember that in order to print the Text objects, you must call their displayText function.
Function name: printVideoGameDetailsToFile
- Parameters: a file stream object (sent by reference)
- Returns: none (void)
- Purpose: This function should be called when the user wants to print ALL the video game information to the file.
- Specifications: Print the title, year, genre, rating & number of stars to the filename that was sent to this function. In order to print the Text objects to the file, you must first retrieve the c-string attribute (calling the getText function) from this Text, and then you can print it to the file.
Function name: getVideoGameTitle (accessor function)
- Parameters: none
- Returns: a pointer to the Text object containing the video game title
THIS IS THE MY HEADER FILE:
THE FOLLOWING IS THE NEXT HEADER FILE IM TRYING TO WRITE BUT HAVING SOME TROUBLE WITH THE LAST FEW FUNCTIONS. ALSO CAN SOMEONE DOUBLE CHECK THE FUNCTIONS I HAVE WRITTEN AND TELL ME IF THEY ARE CORRECT?
HERES THE WRITTEN CODE FROM THE PICTURE. THANKS IN ADVANCE
#ifndef VIDEOGAME_H #define VIDEOGAME_H
#include #include
class VideoGame { private: string *title; string *platform; int *year; string *genre; int *ageRating; int *userRating; public: VideoGame(string title, string platform, int year, string genre, int ageRating, int userRating) { this->*title = title; this->*platform = platform; this->*year = year; this->*genre = genre; this->*ageRating = ageRating; this->*userRating = userRating; }; ~VideoGame() { delete[] title; delete[] platform; delete[] year; delete[] genre; delete[] ageRating; delete[] userRating; cout
H #include "VideoGameLibrary.h" #include "VideoGame.h" #include "Text.h" Text (const char *tempArray) { int n = 0; while (tempArray[n] != 0) 00) O! |- n ++; | | | | | textLength = n; char *array = new char(n + 1]; | | | | for (int i = 0; iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started