Modify the GreenvilleRevenue program created in Chapter 10, Case Study 1 so that it performs the following tasks:
- The program prompts the user for the number of contestants in this year’s competition; the number must be between 0 and 30. Use exception-handling techniques to ensure a valid value and display the error message:Number must be between 0 and 30
- The program prompts the user for talent codes. Use exception-handling techniques to ensure a valid code and update the displayed message to the following message:x is not a valid talent code. Assigned as Invalid.where x was the invalid code entered into the console.
- After data entry is complete, the program prompts the user for codes so the user can view lists of appropriate contestants. Use exception-handling techniques for the code verification and display the following message:
Enter a talent type or Z to quit >> x x is not a valid code
and for valid codes:
Enter a talent type or Z to quit >> S Contestants with talent Singing are: Adult Contestant Mark S Fee $30.00
where x was the invalid code entered into the console.
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")));
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 1 images
- A finally statement, when used as part of exception handling will be executed... Select one: O a. always, no matter if there is an exception or not. O b. only if the program is going to exit. only if no exception occurred. С. O d. only if an exception is generated, even if the exception is handled by other code.arrow_forwardFoundation in java Please provide a basic exception code. Do not use input, output. Please provide code and explain. Thank you. Write the Java code for the following: Write the InvalidGradeException class that will be used below. Write the Java program that reads an integer grade from a user and checks that it is valid (between 0 and 100). If it is invalid an InvalidGradeException will be thrown, stating what the invalid grade is. This will be caught in the main( ) method which will write a message about the invalid grade. If the grade is valid, it is written to the monitor..arrow_forwardPlease answer question. This is pertaining to Java programming language 3-19arrow_forward
- in c++ Define a new exception class named “BadValueException” that must inherit from the exception class. It will manage and capture the general invalid integer and double value. It must be able to describe the reason for the error and save away the erroneous value. In another words, when the caller catches the exception and receives this object, it must know what the reason for the exception is and the actual bad value that caused the exception.arrow_forwardAgain --4. Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burning_heart_rate() to calculate the fat burning heart rate. The adult's age must be between the ages of 18 and 75 inclusive. If the age entered is not in this range, raise a ValueError exception in get_age() with the message "Invalid age." Handle the exception in __main__ and print the ValueError message along with "Could not calculate heart rate info." Ex: If the input is: 35 the output is: Fat burning heart rate for a 35 year-old: 129.5 bpm If the input is: 17 the output is: Invalid age. Could not calculate heart rate info.?.arrow_forward3-19 Please write a CHECKED EXCEPTION in Java Code per the instructions and make sure your code compiles before submitting. Thank you!arrow_forward
- Programming Problem 1 – CycleThrowTryCatch Revisit the Cycle class in Module 3. Modify your application such that the properties, numberOfWheels and weightare entered as double values interactively (at the keyboard). Exception handling will be used to determine whether a type mismatch occurs. Edit your application such that, in addition to [A], the values for numberOfWheels and weight, entered interactively, will throw a new exception “Values cannot be less than or equal to zero” only If the values are less than or equal to zero. Add or use the appropriate try and/or catch blocks. Directions Examine your application for the class called Cycle. Add Try and Catch blocks appropriately. Add the throw statement for the new exception. Display an appropriate message if an exception occurs. Display the properties of the object.arrow_forwardWhen using an else statement as part of exception handling the code in the else- block will only be executed if... Select one: O a. during the execution of the code in the exception handling block there is an error or exception generated. O b. no exception occurs during the execution of the code inside the exception handling block. С. it is always executed. O d. there is an exception and it is not handled by any other code.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY