Question: What is wrong with the lines of code? using System; using static System.Console; using System.Globalization; class GreenvilleRevenue { static void Main() { int contestantThisYear =

What is wrong with the lines of code?

using System;

using static System.Console;

using System.Globalization;

class GreenvilleRevenue

{

static void Main()

{

int contestantThisYear = 0;

int contestantLastYear = 0;

string input;

// get contestant number of this year

WriteLine("Enter the number of contestants for this year:");

input = ReadLine();

while (!int.TryParse(input, out contestantThisYear) || contestantThisYear < 0)

{

WriteLine("Invalid input. Enter a positive integer value:");

input = ReadLine();

}

// get contestant number of last year

WriteLine("Enter the number of contestants for last year:");

input = ReadLine();

while (!int.TryParse(input, out contestantLastYear) || contestantLastYear < 0)

{

WriteLine("Invalid input. Enter a positive integer value:");

input = ReadLine();

}

// display relationship

DisplayRelationship(contestantThisYear, contestantLastYear);

// get contestants' data

string[] names = new string[contestantThisYear];

char[] talents = new char[contestantThisYear];

char[] talentCodes = new char[contestantThisYear];

string[] talentCodesStrings = new string[] { "Vocal", "Dance", "Instrument", "Theater" };

int[] counts = new int[4];

GetContestantData(contestantThisYear, names, talents, talentCodes, talentCodesStrings, counts);

// get lists

GetLists(contestantThisYear, talentCodes, talentCodesStrings, names, talents, counts);

}

public static int GetContestantNumber(string when, int min, int max)

{

// Write your GetContestantNumber() here.

}

public static void DisplayRelationship(int numThisYear, int numLastYear)

{

// Write your DisplayRelationship() here.

WriteLine("This years contest has " + (numThisYear < numLastYear ? "fewer" :

numThisYear == numLastYear ? "the same" : "more") +

" contestants than last years.");

}

public static void GetContestantData(int numThisYear, string[] names, char[] talents, char[] talentCodes, string[] talentCodesStrings, int[] counts)

{

for (int i = 0; i < numThisYear; i++)

{

WriteLine("Enter the name of contestant " + (i + 1) + ":");

names[i] = ReadLine();

bool validInput = false;

while (!validInput)

{

Write("Enter the talent code (V, D, I, T) of contestant " + (i + 1) + ": ");

string talentInput = ReadLine();

if (talentInput.Length != 1)

{

WriteLine("Invalid format - entry must be a single character");

}

else if (!char.TryParse(talentInput, out talents[i]))

{

WriteLine("Invalid input - please enter a single character");

}

else if (Array.IndexOf(talentCodesStrings, talentCodesStrings[Array.IndexOf(talentCodes, talents[i])]) != -1)

{

WriteLine("That talent code has already been used. Please try again");

}

else if (!"VDIT".Contains(talents[i].ToString().ToUpper()))

{

WriteLine("That is not a valid code");

}

else

{

talentCodes[i] = talentCodesStrings[talents[i].ToString().ToUpper

string talentInput = ReadLine();

}

while (!char.TryParse(talentInput, out talents[i]) || !Array.Exists(talentCodesStrings, element => element[0] == talents[i]))

{

WriteLine("Invalid input. Enter a single character among V, D, I, T:");

talentInput = ReadLine();

}

The feed back is:

GreenvilleRevenue.cs(88,20): error CS1525: Unexpected symbol `string' GreenvilleRevenue.cs(95,246): error CS1525: Unexpected symbol `end-of-file' Compilation failed: 2 error(s), 0 warnings Cannot open assembly 'GreenvilleRevenue.exe': No such file or directory.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!