Question: using System; using System.Globalization; class GreenvilleRevenue { static void Main ( ) { / / Declare variables to store user inputs int lastYearContestants, thisYearContestants; double
using System; using System.Globalization; class GreenvilleRevenue static void Main Declare variables to store user inputs int lastYearContestants, thisYearContestants; double revenue; Get the number of contestants last year with input validation Console.WriteEnter number of contestants last year ; while int.TryParseConsoleReadLine out lastYearContestants Console.WriteLineInvalid format please enter a valid integer."; Console.WriteEnter number of contestants last year ; Get the number of contestants this year with input validation Console.WriteEnter number of contestants this year ; while int.TryParseConsoleReadLine out thisYearContestants Console.WriteLineInvalid format please enter a valid integer."; Console.WriteEnter number of contestants this year ; Display the number of contestants for both years Console.WriteLineLast year's competition had contestants, and this year's has contestants", lastYearContestants, thisYearContestants; Calculate and display the expected revenue for this year revenue thisYearContestants ; Console.WriteLineRevenue expected this year is revenue.ToStringC CultureInfo.GetCultureInfoenUS; Display a message indicating the competition is bigger than ever Console.WriteLineThe competition is bigger than ever!"; Variables for talent counting and contestant names string contestantName, talentCode; int singingCount dancingCount instrumentCount otherCount ; Get the contestant name with input validation Console.WriteEnter contestant name ; contestantName Console.ReadLine; while true Display talent codes Console.WriteLineTalent codes are:"; Console.WriteLine S Singing"; Console.WriteLine D Dancing"; Console.WriteLine M Musical instrument"; Console.WriteLine O Other"; Get talent code with input validation Console.Write Enter talent code ; talentCode Console.ReadLine; char talent; Validate talent code and update counts accordingly if charTryParsetalentCode out talent switch talent case S: singingCount; break; case D: dancingCount; break; case M: instrumentCount; break; case O: otherCount; break; default: Console.WriteLineThat is not a valid code"; continue; else Console.WriteLineInvalid format entry must be a single character"; continue; Get the contestant name with input validation Console.WriteEnter contestant name ; contestantName Console.ReadLine; Display the types of talent and their counts Console.WriteLineThe types of talent are:"; Console.WriteLineSinging singingCount; Console.WriteLineDancing dancingCount; Console.WriteLineMusical instrument instrumentCount; Console.WriteLineOther otherCount; Get the talent type or allow the user to quit Console.WriteEnter a talent type or Z to quit ; talentCode Console.ReadLine; if talentCodeToUpperZ break;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
