Question: Please help with this C# prompt to create a method with two overloads. Any help would be appreciated, thanks! Write a method: GetValidString with two
Please help with this C# prompt to create a method with two overloads. Any help would be appreciated, thanks!


Write a method: GetValidString with two overloads. Overload 1 takes 3 parameters: A string to use as a prompt A minimum number of characters. A maximum number of characters. Overload 2 takes only 2 parameters: o Astring to use as a prompt o A minimum number of characters o If overload 2 is called, there is no maximum length -Return: A valid string -Function: Using the supplied prompt, asks the user for a string. Keeps prompting the user until it gets one that is of valid length. Returns the string to the caller. Make sure the minimum and maximum values are compatible with each other! In Maino: Call GetValidString to get: A required name (>=1 characters, no maximum length) An optional description (>=0 characters, no more than twenty characters.) o A product ID (4 - 5 characters) A state code (exactly 2 characters). Note: you don't have to validate that the state code is for a valid state, only that the state code is two characters long. ...from the user. Send appropriate prompts for each Finally, after a valid value for each field as been collected, print each value. Output should look like this: Please enter name: Invalid value. name must be at least 1 character long. Please re-enter name: Pasquale DuBois Please enter description: Private Investigator Extraordinaire Invalid value. description must be between 0 and 20 characters long. Please re-enter description: Private Investigator Please enter Product Id: X23456 Invalid value. Product Id must be between 4 and 5 characters long. Please re-enter Product Id: X2346 Please enter state abbreviation: Wisconsin Invalid value. state abbreviation must be exactly 2 characters long. Please re-enter state abbreviation: WI Name: Pasquale DuBois Description: Private Investigator Product ID: X2346 State: WI Press any key to exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
