Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 2: Video Games Sales 2017 PLEASE HELP PLEASE HELP PLEASE HELP PLEASE HELP Overview please help to complete the code bellow using C# only

Assignment 2: Video Games Sales 2017

PLEASE HELP

PLEASE HELP

PLEASE HELP

PLEASE HELP

Overview

please help to complete the code bellow using C# only

I have the CSV file (the Data) but I can not add it here

Create an application (Either command line or Graphical User Interface) to display some statistics about the Video Games Sales 2017. Directions Start by downloading the attached assignment starter code The starter code includes a CSV (comma-separated value) file containing the data about Video Games Sales 2017. The starter code already loads this file, and store the information in the collection. You should first identify any (6) questions that you wanted to ask from the collection. Once you have identified that, then use LINQ to query the collection and display the results. You should use below concepts while writing the LINQ queries.

1. Basic Queries 2. Fluent Queries 3. Projection 4. Query Syntax For example, you can write one LINQ query as a Basic Query, once as a fluent query, one query where you use projections and when where you use query syntax. And then you can write some queries that use a combination of these.

Evaluation

For each of the query, Use code will be evaluation based on the following rubric. 1. Cleary written the query (question) to be asked. (2 Marks) a. You can use console.Writeline() to display this 2. Clearly written the query (5 marks) 3. Display the results in a readable fashion. (3 marks) Marks will be deducted if you have not implemented the concepts we discussed during above (e.g. Basic Queries, Fluent Queries, Projection and Query Syntax)

using System; using System.Collections.Generic; using System.Linq; using System.IO;

public class Game { public readonly string Name; public readonly string Platform; public readonly int ReleaseYear; public readonly string Genre; public readonly string Publisher; public readonly double NASales; public readonly double EUSales; public readonly double JPSales; public readonly double OtherSales; //public readonly double GlobalSales; public readonly double CriticScore; public readonly int CriticCount; public readonly double UserScore; public readonly int UserCount; public readonly string Rating;

private string NextValue(string csv, ref int index) { string result = ""; if (index < csv.Length) { if (csv[index] == ',') { index++; } else if (csv[index] == '"') { int endIndex = csv.IndexOf('"', index + 1); result = csv.Substring(index + 1, endIndex - (index + 1)); index = endIndex + 2; } else { int endIndex = csv.IndexOf(',', index); if (endIndex == -1) result = csv.Substring(index); else result = csv.Substring(index, endIndex - index); index = endIndex + 1; } } return result; }

public Game(string csv) { int index = 0; Name = NextValue(csv, ref index); Platform = NextValue(csv, ref index); int.TryParse(NextValue(csv, ref index), out ReleaseYear); Genre = NextValue(csv, ref index); Publisher = NextValue(csv, ref index); double.TryParse(NextValue(csv, ref index), out NASales); double.TryParse(NextValue(csv, ref index), out EUSales); double.TryParse(NextValue(csv, ref index), out JPSales); double.TryParse(NextValue(csv, ref index), out OtherSales); NextValue(csv, ref index); //public readonly double GlobalSales; double.TryParse(NextValue(csv, ref index), out CriticScore); int.TryParse(NextValue(csv, ref index), out CriticCount); double.TryParse(NextValue(csv, ref index), out UserScore); int.TryParse(NextValue(csv, ref index), out UserCount); Rating = NextValue(csv, ref index); } }

class Program { static List Games = new List();

static void BuildDB() { string input; while ((input = Console.ReadLine()) != "") { var game = new Game(input); Games.Add(game); } }

static void BuildDBFromFile() { using (var reader = File.OpenText("Video Game Sales 2017.csv")) { string input = reader.ReadLine(); // Skip label row while ((input = reader.ReadLine()) != null) { var game = new Game(input); Games.Add(game); } } }

static void Main(string[] args) { BuildDBFromFile();

// Part 1 { // Write your code here }

// Part 2 { // Write your code here } // Part 3 { // Write your code here }

// Part 4 { // Write your code here } // Part 5 { // Write your code here } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Accounting questions