Player inputs a preferred console type

Assignment Help Business Management
Reference no: EM131861824

Currently, there is a test program that calls a player's class. The program asks the player for a name and then gives options on what happens next. The only option available is to quit. Add an additional option and supporting code in the player header that will allow the player to input a preferred console type. After the player inputs a preferred console type, be sure to redisplay it. 

GameLoop.cpp

#include "GameLoop.h"

#include <iostream>

using namespace std;

void Game::WelcomePlayer()

{

cout << "Welcome to Text Adventure!" << endl << endl;

cout << "What is your name?" << endl << endl;

string name;

cin >> name;

m_player.SetName(name);

cout << endl << "Hello " << m_player.GetName() << endl;

}

void Game::GivePlayerOptions() const

{

cout << "What would you like to do? (Enter a corresponding number)" << endl << endl;

cout << "1: Quit" << endl << endl;

}

void Game::GetPlayerInput(string& playerInput) const

{

cin >> playerInput;

}

PlayerOptions Game::EvaluateInput(string& playerInput) const

{

PlayerOptions chosenOption = PlayerOptions::None;

if (playerInput.compare("1") == 0)

{

cout << "You have chosen to Quit!" << endl << endl;

chosenOption = PlayerOptions::Quit;

}

else

{

cout << "I do not recognise that option, try again!" << endl << endl;

}

return chosenOption;

}

void Game::RunGame()

{

WelcomePlayer();

bool shouldEnd = false;

while (shouldEnd == false)

{

GivePlayerOptions();

string playerInput;

GetPlayerInput(playerInput);

shouldEnd = EvaluateInput(playerInput) == PlayerOptions::Quit;

}

}

Player header

#pragma once

#include <string>

class Player

{

private:

std::string m_name;

public:

Player()

{

}

void SetName(const std::string& name)

{

m_name = name;

}

const std::string& GetName() const

{

return m_name;

}

};

Reference no: EM131861824

Questions Cloud

Operating system design principle : As an operating system design principle, what security benefits does "simplicity" provide? Explain.
Make short program that uses a for loop to populate an array : How can i make short program that uses a for loop to populate an array. The array can store up to 10 integers.
Determine the supporting factors that would aid : Determine the supporting factors that would aid in the reduction of healthcare cost in your organization without reducing quality of care for the patients.
Discussing file permissions : When discussing File Permissions, chmod command and its symbolic and octal notations other than r, w and x, there are some other kinds of permissions.
Player inputs a preferred console type : Add an additional option and supporting code in the player header that will allow the player to input a preferred console type.
Discuss the implications of agency that apply in situation : Your friends wear the business uniform, deal with vendors and customers, and tell friends and family that they work for the business.
What is the purpose of protocols in industrial control : What is the purpose of protocols in industrial control systems? What would be the best protocol for integration into a SCADA system?
Serialize the objects of a class animal : As a team of software developers serialize the objects of a class animal to a file as a Visual Studio® solution. Please give both a downloadable file
Write a program to meet the specifications of the company : Using Visual Studio® and C# programming concepts, write a program to meet the specifications of the company's request. The program should have the following:

Reviews

Write a Review

Business Management Questions & Answers

  Question regarding the master scheduling

As the textbook describes, a "master scheduling is the heart of production planning and control."  This planning in master scheduling drives every aspect of the company from material requirements, capacities, delivery, and commitments to customers..

  Introduction to the concept of sustainability

Develop a comprehensive report that includes an introduction to the concept of sustainability.

  Amount resulting from technological progress

Suppose the growth rate of GDP in the United States is 4.2%. If 2.9% and 1.3% of GDP growth are due, respectively, to capital and labor growth, the amount resulting from technological progress is

  How established leadership practices support innovation

Analyze how established leadership practices support innovation in organizations. Create and support innovation in organizations.

  Loan payment using the expression builder

Add a new field named Loan Payment using the Expression Builder. Insert the PMT function to determine the monthly payment for a 2-year loan, paid monthly, with a 5% yearly interest rate.

  Tuition reimbursement as employee benefit

New professional opportunities you believe this degree affords to employees - types of careers peopl with the degree often

  Differentiating male and female leaders in leadership styles

Do male and female leaders differ in their behavior and leadership styles in organizations?

  What can they learn from the adopting innovation

Pick an industry (e.g. groceries, airlines, publishing, etc.) and explain the innovative process that must take place for successful integration of innovation and Recommend how an industry leader should search, select, implement, acquire, execute,..

  Difference between strategic hr and traditional hr

What is the difference between strategic HR and traditional HR? What does it mean for an HR professional to be a "strategic" part of the business?

  Role of software in project management

Discuss how project management technique scan be used to improve the completion of projects. With this inmind, discuss the role of start and finish times with respect toproject completion time. Explain the role of software in projectmanagement.

  Additional details to fit the scenario

Be sure to address the note to a specific person and use an appropriate subject line.

  Assignment-marketing information systems

You work for an automobile manufacturer that offers a complete line of vehicles, from full-size pickups and luxury sport-utility vehicles (SUVs) to economy cars and hybrids. After analyzing the recent changes in consumers' buying habits, your mana..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd