Starting from:

$30

CSE102-Homework 7 Solved

Write a complete program describing all the tasks below. 

Part 0: The program reads a text file named ‘Video_Games.txt’. Every row of this text file includes several informations about a single game. You are asked to read every row as a string and decompose these informations which are separated by commas. 

 

Here is the excel format of the txt file, so that you can get used to the data.

 

 

 

•        The program should keep the names of the games in a one-dimensional string array.

•        The program should keep the names of the genres & platforms in two different one-dimensional strring arrays. Please be sure that the elements are not overlapping! I.e. there shouldn’t be more than one ‘simulation’ in the array just because there are more than one simulation games.

•        The program should keep the data of every single game in a two-dimensional float array.  This array should include 7 different data for every game, including genre&platform. The genre/platform cell should point the index of the genre/platform array which stores the names of the related genre/platform.

For example;

If the genre of the game is ‘simulation’ and the index of the string ‘simulation’ in the array of genres is 5, then the cell which shows the genre of the game should be ‘5.0’ in the float array.

 

Be careful! Some of the games has no value for ‘global_sales’ data. They have a string ‘not_available’ instead of a float number. Store them in the float array wisely cause you will need that information later on!

•        The float array shouldn’t include any information about the name of the games since they are stored in a string array with the same indexes.

 

 

 

 

Part 1: The program should support 8 different operations. Therefore, there should be a menu as below. The program should terminate if and only if the user enters ‘8’ as the input. The menu should appear again and again if an input is invalid or if the previously requested operation is done. If the menu appears because of an invalid input, there should be an error message too.

 

 



 

Part 2:  0th and the 1st operations are almost the same. If the user enter ‘0’ (or ‘1’) as input, then the program should list the genres (or the platforms) as strings.



Part 3: 2nd operation lists the games according to an information received from the user. Firstly, the program asks for a ‘year’, after that the program asks ‘until that year or since that year?’. Finally the program lists the names of the all games which released until/since that year. Don’t forget that the program should handle the invalid year or period values. I.e. if the oldest game was released in 1995 and the user wants to print the game which released until 1996, the program should show an error message and asks for new values since there is no game before 1996. 



 

 

 

 

 

Part 4: The 3rd operation asks for a game name from the user. If the input matches with a name from the name array, then the program prints all information of that game. If the input doesn’t match with any element of the name array, then it should give an error message and ask for a new input. If the ‘global_sales’ information of that game was ‘not_available’ when the program read it, then the users should see it as ‘Not Available’.



 Part 5: 4th operation basically calculates and prints the average of the user scores of all games. 

 

 

 

Part 6: 5th operation asks a game name and prints either the game was more populer in NA or EU according to the sales. If the sales are equal, specify that. Again, if the game name is not in the database, the program should ask for another name.



 

Part 7: 6th and 7th operations are printing the frequences of every genre/platform. I.e. they prints the number of games for every genre/platform.



 

❖  You can assume that;

➢  The longest game name has 100 characters

➢  The longest genre or platform name has 20 characters.

➢  The longest row of the text file has 200 characters

 

❖  You are not allowed to use any library other than; 

➢  <stdio.h

➢  <string.h

➢  <stdlib.h

❖  You can use the ‘strtod’ function from <stdlib.h library to parse a string to float.

❖  Some games are released on different platforms, which means some of the game names are the same. When you are search for a game with the name of it, pick the first one you find. 

❖  You can write your own functions to make things easier.

❖  Don’t forget that the program shouldn’t terminate when an operation is done.

More products