The user enters some text into a textbox. It can contain any characters (letters, digits, spaces, punctuation marks, and there is no length limitation. It should be shown using Courier New font.

When a button Count is hit, display the number of digits and the number of upper-case letters in the inputted phrase. see image.

Suggestions on approaching this task

Exploration of fundamental classes is a necessary part of learning C#. There is no way to fit everything into the textbook or other class materials. Using specialized methods helps to reduce the amount of code you have to write. String class has many methods that you can discover. You can start at https://docs.microsoft.com/en-us/dotnet/api/system.string . It may be easier to search in Google (for example: C# string methods) than within https://docs.microsoft.com/. For example, String methods Substring( ), Contains( ) may be helpful but you may need not just those ones.

Take special care not to overstep the String boundary when you use its methods and functions. If you do, to preserve the content of memory outside of the defined string (and also not to return non- existing information), the .NET system will stop the execution and report an exception. If it happens, fix it; you may need to switch to step-by-step execution and maybe watch the variables to catch what leads to such an error.

You have to distinguish the algorithmic part of the problem and its configurable part. For example, this version assumes counting decimal digits but the next one may specify counting hexadecimal ones. Your program should not require altering the code, except changing a constant.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.