Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Case Problem 10-1: Instructions: Previously, you created a Contestant class for the Greenville Idol competition. The class includes a contestants name, talent code, and talent

Case Problem 10-1:

Instructions:

Previously, you created a Contestant class for the Greenville Idol competition. The class includes a contestants name, talent code, and talent description. The competition has become so popular that separate contests with differing entry fees have been established for children, teenagers, and adults.

Now, modify your program so the Contestant class contains the field Fee that holds the entry fee for each category, and add get and set accessors.

Extend the Contestant class to create three subclasses: ChildContestant, TeenContestant, and AdultContestant. Child contestants are 12 years old and younger, and their entry fee is $15. Teen contestants are between 13 and 17 years old, inclusive, and their entry fee is $20. Adult contestants are 18 years old and older, and their entry fee is $30.

In each subclass, set the entry fee field to the correct value, and override the ToString() method to return a string that includes all the contestant data, including the age category and the entry fee. For example, the output from ToString() should be displayed in the following format:

Child Contestant Joeph S Fee $15.00 Teen Contestant Sara M Fee $20.00 Adult Contestant Joy D Fee $30.00

In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format the output statements as follows: WriteLine("This is an example: {0}", value.ToString("C", CultureInfo.GetCultureInfo("en-US")));

Step 2:

Modify the GreenvilleRevenue program so that it performs the following tasks:

The program prompts the user for the number of contestants in this years competition, which must be between 0 and 30. The program continues to prompt the user until a valid value is entered.

The program prompts the user for the name, talent code, and age for each contestant. Along with the prompt for a talent code, display a list of valid categories. Based on the age entered for each contestant, create an object of the correct type (adult, teen, or child), and store it in an array of Contestant objects. Talent code categories should be displayed in the following format:

Talent codes are: S Singing D Dancing M Musical instrument O Other

After data entry is complete, display the total expected revenue, which is the sum of the entry fees for the contestants. The total expected revenue should be displayed in the following format:

Revenue expected this year is $65.00

After data entry is complete, display the valid talent categories and then continuously prompt the user for talent codes, and display all the data for all the contestants in each category (using the ToString method for each contestant). Display an appropriate message if the entered code is not a character or a valid code.

Grading

When you have completed your program, click the Submit button to record your score.

image text in transcribed

image text in transcribed image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

\{ \} // childcontestant Class implementation class ChildContestant : Contestant \{ public ChildContestant(string name, string code, string descript : base(name, code, description, 15.00 ) \{ \} public override string Tostring() \{ return \$"Child Contestant { base.ToString()\}"; \} \} // teencontestant Class implementation class TeenContestant : Contestant \{ public TeenContestant(string name, string code, string descripti : base(name, code, description, 20.00 )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Database And Expert Systems Applications Dexa 2022 Workshops 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 In Computer And Information Science 33

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Alfred Taudes ,Atif Mashkoor ,Johannes Sametinger ,Jorge Martinez-Gil ,Florian Sobieczky ,Lukas Fischer ,Rudolf Ramler ,Maqbool Khan ,Gerald Czech

1st Edition

ISBN: 3031143426, 978-3031143427

More Books

Students also viewed these Databases questions

Question

There are five key steps in process-cost accounting. What are they?

Answered: 1 week ago