Question

C++ project The project will allow you to create a system for tracking the games and...

C++ project

The project will allow you to create a system for tracking the games and the scores in terms of graphics, story and replay value and will compute the highest score in each category and the highest overall score. The system will allow you to track 5 games in the following arrays: 1) A string array for the game titles 2) An int array for graphics scores from 1 to 5 3) An int array for replay value from 1 to 5 (1 being the worst score and 5 being the best score) The main function will allow the user to call the following functions: 1. Enter Game Titles 2. Enter Graphic Scores 3. Enter Replay Scores 4. Find the highest graphic score 5. Find the highest replay value score 6. Find the highest combined score 7. Exit Note you can assume that the steps in the menu will be executed in order. 1) Function1 : enterGameInfo() This function will ask the user for the 5 game titles and store them in an array which will be accessible throughout the program. Enter game title: 2) Function: enterGraphicInfo() This function will ask the user for the 5 graphic scores and store them in an array while referring to the game title. Enter the graphic score for the game title [Game Title]: 3) Function: enterReplayInfo() This function will ask the user for the 5replay value scores and store them in an array while referring to the game title. Enter the replay value for the game title [Game Title]: 4) Function: getHighestGraphics() A function that will get as parameters the game title array and the graphics score array. The function will find the highest graphic score and will print the following: “The highest rated graphics game is [Game Title] with a score of [Highest Score]” If multiple games have the same graphic score, chose the last highest score in the array. 5) Function: getHighestReplay() A function that will get as parameters the game title array and the replay score array. The function will find the highest replay score and will print the following: “The highest rated replay game is [Game Title] with a score of [Highest Score]” If multiple games have the same graphic score, chose the last highest score in the array. 6) Function: getHighestCombined() A function that per game will add the graphics score and the replay value score as one score and add the new combined score a new array while finding the highest combined score. The function will print the following: “The highest rated combined score game is [Game Title] with a score of [Highest Score]” Notes: Make sure you can enter games with spaces Make sure you create the functions specified Grading Criteria: 1. Enter Game Titles (5 pts) 2. Enter Graphic and Replay Scores (5 pts) 3. Find the highest graphic and replay value score (5 pts) 4. Find the highest combined score (5 pts)

Homework Answers

Answer #1

C++ Program with comments:

Source.cpp

/*
The project will allow you to create a system for tracking the games and the scores in terms of graphics,
story and replay value and will compute the highest score in each category and the highest overall score.
*/
#include <iostream>
#include <string>
using namespace std;

#define NOOFGAMES 5

//1) A string array for the game titles
string gametitles[NOOFGAMES];

// 2) An int array for graphics scores from 1 to 5
int graphicsscores[NOOFGAMES];

//3) An int array for replay value from 1 to 5
int replayvalue[NOOFGAMES];


//1) Function1 : enterGameInfo() This function will ask the user for the 5 game titles
//and store them in an array which will be accessible throughout the program. Enter game title:
void enterGameInfo()
{
   string str;
   for (int i = 0; i < 5; i++)
   {
       cout << "Enter Game Title" << endl;
       cin >> str;
       gametitles[i] = str;
   }
}

//2) Function: enterGraphicInfo() This function will ask the user for the 5 graphic scores
//and store them in an array while referring to the game title.
//Enter the graphic score for the game title [Game Title]:

void enterGraphicInfo()
{
   int score;
   for (int i = 0; i < 5; i++)
   {
       cout << "Enter the graphic score for the Game Title [" << gametitles[i] <<"]"<<endl;
       cin >> score;
       if (score < 1 || score > 5)
       {
           cout << "Graphic Scores range between 1 and 5" << endl;
           i--;
       }
       else
       {
           graphicsscores[i] = score;
       }
   }
}

//3) Function: enterReplayInfo()
//This function will ask the user for the 5replay value scores and store them in an array
//while referring to the game title. Enter the replay value for the game title [Game Title]:

void enterReplayInfo()
{
   int score;
   for (int i = 0; i < 5; i++)
   {
       cout << "Enter the replay value for the Game Title [" << gametitles[i] << "]" << endl;
       cin >> score;
       if (score < 1 || score > 5)
       {
           cout << "Replay Values range between 1 and 5" << endl;
           i--;
       }
       else
       {
           replayvalue[i] = score;
       }
   }
}

//4) Function: getHighestGraphics() A function that will get as parameters the game title array
//and the graphics score array. The function will find the highest graphic score and will print the following:
//“The highest rated graphics game is [Game Title] with a score of [Highest Score]”
//If multiple games have the same graphic score, chose the last highest score in the array.

void getHighestGraphics()
{
   int maxscore = 0;
   string title;
   for (int i = 0; i < 5; i++)
   {
       if (graphicsscores[i] >= maxscore)
       {
           maxscore = graphicsscores[i];
           title = gametitles[i];
       }
   }
   cout << "The highest rated graphics game is [" << title << "] with a score of [" << maxscore << "]" << endl;
}

//5) Function: getHighestReplay() A function that will get as parameters the
//game title array and the replay score array.
//The function will find the highest replay score and will print the following:
//“The highest rated replay game is [Game Title] with a score of [Highest Score]”
//If multiple games have the same graphic score, chose the last highest score in the array.

void getHighestReplay()
{
   int maxscore = 0;
   string title;
   for (int i = 0; i < NOOFGAMES; i++)
   {
       if (replayvalue[i] >= maxscore)
       {
           maxscore = replayvalue[i];
           title = gametitles[i];
       }
   }
   cout << "The highest rated Replay game is [" << title << "] with a score of [" << maxscore << "]" << endl;
}

//6) Function: getHighestCombined() A function that per game will add the graphics score
//and the replay value score as one score and add the new combined score a new array while
//finding the highest combined score. The function will print the following:
//“The highest rated combined score game is [Game Title] with a score of [Highest Score]”

void getHighestCombined()
{
   int combinedscore[NOOFGAMES];
   int maxscore = 0;
   string title;
   for (int i = 0; i < NOOFGAMES; i++)
   {
       combinedscore[i] = graphicsscores[i] + replayvalue[i];
       if (combinedscore[i] >= maxscore)
       {
           maxscore = combinedscore[i];
           title = gametitles[i];
       }
   }
   cout << "The highest rated combined score game is [" << title << "] with a score of [" << maxscore << "]" << endl;
}


int main()
{
   //The main function will allow the user to call the following functions:
   //1. Enter Game Titles
   //2. Enter Graphic Scores 3. Enter Replay Scores 4. Find the highest graphic score
   //5. Find the highest replay value score 6. Find the highest combined score
   //7. Exit
  
   bool flag = true;
   int i, response;

   while (flag)
   {
       cout << "Select option from Menu" << endl;
       cout << "1. Enter Game titles" << endl;
       cout << "2. Enter graphic scores" << endl;
       cout << "3. Enter Replay Scores " << endl;
       cout << "4. Find the highest graphic score" << endl;
       cout << "5. Find the highest replay value score" << endl;
       cout << "6. Find the highest combined score" << endl;
       cout << "7. Exit" << endl;

       cin >> response;

       switch (response)
       {
       case 1:
           enterGameInfo();
           break;
       case 2:
           enterGraphicInfo();
           break;
       case 3:
           enterReplayInfo();
           break;
       case 4:
           getHighestGraphics();
           break;
       case 5:
           getHighestReplay();
           break;
       case 6:
           getHighestCombined();
           break;
       case 7:
           flag = false;
           break;
       default:
           cout << "Invalid option. Try again" << endl;
           break;
       }
   }
}

Sample I/O and Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using C++ 1. Create a program that asks the user to create 5 triangles, asking for...
Using C++ 1. Create a program that asks the user to create 5 triangles, asking for 5 bases and 5 heights (you can use an array), have a function to print the triangle bases, heights, and areas 2. Create a structure for the Triangle that holds the base and height of the triangles. Ask the user for 5 triangles, and print them. 3. Create an array of 5 structures - ask the user for 5 triangles, and then print the...
Create a program to calculate and print basic stats on a set of a given input...
Create a program to calculate and print basic stats on a set of a given input values representing students' scores on an quiz. 1) Ask the user for the total number of quiz scores to be input (assume a positive integer will be given). 2) Create an array to hold all the quiz scores and then get all the scores from input to put into the array. For example, if the user input 10 in step (1) then you should...
Write a function in c using #include <stdio.h> that takes a one-dimensional integer array and returns...
Write a function in c using #include <stdio.h> that takes a one-dimensional integer array and returns the index of the first occurance of the smallest value in the array. Your function must be able to process all the elements in the array. Create a function prototype and function definition (after the main function). Your main function should declare a 100 element integer array. Prompt the user for the number of integers to enter and then prompt the user for each...
Assignment #4 – Student Ranking : In this assignment you are going to write a program...
Assignment #4 – Student Ranking : In this assignment you are going to write a program that ask user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’...
Using C programming Create a function called printMenu( ) with the following properties: Has no function...
Using C programming Create a function called printMenu( ) with the following properties: Has no function inputs or output. Prints the following menu to the screen: 1. Enter user name. 2. Enter scores. 3. Display average score. 4. Display summary. 5. Quit Create a function called printLine( ) with the following properties: Takes as input a char Takes as input an integer corresponding to the number of times to print the character Has no function output. For example, if we...
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
**C code only In this part, you will write a simple user-defined function that prints a...
**C code only In this part, you will write a simple user-defined function that prints a message. This function does not require any parameters or return value. The purpose is simply to get you started writing functions.Open repl project Lab: User-Defined Functions 1. Write a program that calls a function. This function should do the following: 1.Ask the user their name 2. Print a "hello" message that includes the user's name Example output: Please enter your name: ​Mat Hello, Mat!...
Questions: 1. (5 marks) Create a VB.NET Console Application that defines a function Smallest and calls...
Questions: 1. Create a VB.NET Console Application that defines a function Smallest and calls this function from the main program. The function Smallest takes three parameters, all of the Integer data type, and returns the value of the smallest among the three parameters. The main program should (1) Prompt a message (using Console.WriteLine) to ask the user to input three integers. (2) Call the built-in function Console.ReadLine() three times to get the user’s input. (3) Convert the user’s input from...
This program is in C++: Write a program to allow the user to: 1. Create two...
This program is in C++: Write a program to allow the user to: 1. Create two classes. Employee and Departments. The Department class will have: DepartmentID, Departmentname, DepartmentHeadName. The Employee class will have employeeID, emploeename, employeesalary, employeeage, employeeDepartmentID. Both of the above classes should have appropriate constructors, accessor methods. 2. Create two arrays . One for Employee with the size 5 and another one for Department with the size 3. Your program should display a menu for the user to...
Using Python, write the following code. You are to allow the user to enter the daily...
Using Python, write the following code. You are to allow the user to enter the daily temperature as a floating-point number. You should make the assumption that you are recording temperatures in Fahrenheit. You should allow the user to continue entering temperatures until the value -999 is entered. This number should not be considered a temperature, but just a flag to stop the program. As the user enters a temperature, you should display the following each time: Current Temperature: 999...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT