#include <iostream>
#include <string>
#include <string.h>
using namespace std;
class game_object
{
public:
int set_id_num(int);
int get_id_num(int);
string set_name(string);
string get_name(string);
int set_type(int);
string get_type(string, int);
float set_buy_value(float);
float get_buy_value(float);
float set_market_value(float);
float get_market_value(float);
int set_year(int);
int get_year(int);
private:
int id_num;//identifier number for the game
string name;//the name of the game
int type;//whether the game is cartridge, CD, DVD, BR, download
string type_name;//type of game
float buy_value;//price of game
float market_value;//value of game
int game_year;//year the game was made
};
int main()
{
game_object test;
test.set_id_num(id_num);
cout << test.get_id_num(id_num) << endl;
return 0;
}
//sets id num for the game
int game_object::set_id_num(int num)
{
cout << "Please enter a four digit id number for the game: ";
cin >> id_num;
id_num = num;
return 0;
}
//displays the id num for the game
int game_object::get_id_num(int num)
{
return(set_id_num(id_num));
}
//sets desired name for game
string game_object::set_name(string name)
{
cout << "Please enter a name for the game: ";
cin.ignore();
getline(cin, name);
return 0;
}
//displays the name of the game
string game_object::get_name(string name)
{
cout << "The name is ";
return(name);
}
//presents a menu to choose type of game
int game_object::set_type(int type_of_game)
{
cout << "There are four types of games." << endl;
cout << " 0. Cartridge " << endl;
cout << " 1. CD " << endl;
cout << " 2. DVD " << endl;
cout << " 3. BR " << endl;
cout << " 4. Download " << endl;
cout << "Which type do you want to set for the game (enter number)? ";
cin >> type_of_game;
return 0;
}
//prints the type of game chosen
string game_object::get_type(string type, int type_of_game)
{
if (type_of_game == 0)
{
type = "cartridge";
cout << "The type is " << type << endl;
}
else if (type_of_game == 1)
{
type = "CD";
cout << "The type is " << type << endl;
}
else if (type_of_game == 2)
{
type = "DVD";
cout << "The type is " << type << endl;
}
else if (type_of_game == 3)
{
type = "BR";
cout << "The type is " << type << endl;
}
else if (type_of_game == 4)
{
type = "download";
cout << "The type is " << type << endl;
}
return 0;
}
//sets the buying value of game
float game_object::set_buy_value(float buy_value)
{
cout << "Please set a buying value for the game: ";
cin >> buy_value;
return 0;
}
//displays the buying value for game
float game_object::get_buy_value(float buy_value)
{
cout << "The game costs ";
return(buy_value);
}
//sets market value
float game_object::set_market_value(float market_value)
{
cout << "Please set the market value of the game: ";
cin >> market_value;
return 0;
}
//displays market value
float game_object::get_market_value(float market_value)
{
cout << "The market value is ";
return(market_value);
}
//sets model year of the game
int game_object::set_year(int year)
{
cout << "What is the model year of the game? ";
cin >> year;
return 0;
}
//displays model year
int game_object::get_year(int year)
{
cout << "The year of the game is ";
return(year);
}
So I need some help to check if I defined the class correctly? Also if you could help me test each function. I don't understand how to call the function within the class. And I get errors with the way I have tried. Please help, thanks.