Question
In C# I am asked to modify my orginal code, to add this feature: Modify the version of the GreenvilleRevenue program created in Chapter 5
In C# I am asked to modify my orginal code, to add this feature:
Modify the version of the GreenvilleRevenue program created in Chapter 5 so that after the user enters the number of contestants in this years competition, the user is prompted for the appropriate number of contestant names and a code for each contestant that indicates the type of talent: S for singing, D for dancing, M for playing a musical instrument, or O for other. Make sure that all entered codes are valid, and if not, reprompt the user to enter a correct code. After contestant data entry is complete, display a count of each type of talent. Then, continuously prompt the user for a talent code until the user enters a sentinel value. With each code entry, display a list of the contestants with that code, or display a message that the code is not valid and reprompt the user.
This is the code that I have so far:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace GreenvilleRevenue { class Program { static void Main(string[] args)
{ int last, curr; while (true) { Console.WriteLine("Enter the number of contestants entered in last year's competition : "); last = Int32.Parse(Console.ReadLine()); if (last < 0 || last > 30) { Console.WriteLine("Error. Please enter a value between 0 and 30."); } else { break; } } while (true) { Console.WriteLine("Enter the number of contestants entered in this year's competition : "); curr = Int32.Parse(Console.ReadLine()); if (curr < 0 || curr > 30) { Console.WriteLine("Error. Please enter a value between 0 and 30."); } else { break; } } if ((last >= 0) && (last <= 30) && (curr >= 0) && (curr <= 30)) Console.WriteLine("The revenue expected for this year's competition : $" + curr * 25 + ' '); if (curr > last * 2) Console.WriteLine("The competition is more than twice as big this year! "); else if (curr > last && curr <= (last * 2)) Console.WriteLine("The competition is bigger than ever! "); else if (curr <= last) Console.WriteLine("A tighter race this year! Come out and cast your vote! ");
Console.ReadLine(); } } }
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