Question
PART THREE: In C# And here is the rest of the GreenvilleRevenue.cs program: public static void GetLists(int numThisYear, char[] talentCodes, string[] talentCodesStrings, string[] names, char[]
PART THREE: In C# And here is the rest of the GreenvilleRevenue.cs program:
public static void GetLists(int numThisYear, char[] talentCodes, string[] talentCodesStrings, string[] names, char[] talents, int[] counts) { int x; char QUIT = 'Z'; char option; bool isValid; int pos = 0; bool found; WriteLine(" The types of talent are:"); for (x = 0; x < counts.Length; ++x) WriteLine("{0, -20} {1, 5}", talentCodesStrings[x], counts[x]); Write(" Enter a talent type or {0} to quit >> ", QUIT); isValid = false; while (!isValid) { if (!char.TryParse(ReadLine(), out option)) { isValid = false; WriteLine("Invalid format. Talent code entry must be a single capitalized character or Z to quit"); Write(" Enter a talent type or {0} to quit >> ", QUIT); } else { if (option == QUIT) isValid = true; else { for (int z = 0; z < talentCodes.Length; ++z) { if (option == talentCodes[z]) { isValid = true; pos = z; } } if (!isValid) { WriteLine("{0} is not a valid code", option); Write(" Enter a talent type or {0} to quit >> ", QUIT); } else { WriteLine(" Contestants with talent {0} are:", talentCodesStrings[pos]); found = false; for (x = 0; x < numThisYear; ++x) { if (talents[x] == option) { WriteLine(names[x]); found = true; } } if (!found) WriteLine("No contestants had talent {0}", talentCodesStrings[pos]); isValid = false; Write(" Enter a talent type or {0} to quit >> ", QUIT); } } } } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started