Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

EXTRA WORK: Exercise 9.2: Work with Strings For this problem we will assume that every name has either 2 or 3 parts each separated from

image text in transcribed

EXTRA WORK:

Exercise 9.2: Work with Strings For this problem we will assume that every name has either 2 or 3 parts each separated from the other by one or more blanks. You may assume each name contains only letters. Every phone number is assumed to have exactly 3 parts each separated from the other by exactly two dashes. Use the split() method to separate the name parts and the phone number parts. If the number of parts for either is not correct tell the user, and ask them to reenter the required data. Set the focus to the data element that is in error. A phone number must contain exactly 10 digits. All other characters will be removed by your software. If the number does not contain 10 digits, catch the error and allow the user to re-enter the number

Exercise 9-2 Work with strings In this exercise, you'll use methods of the String class to work with strings Open the application and add code to parse a name ! . Open the application that's in the C:\C# 201 51Chapter 09.StringHandling directory. Within this project, you'l find a form that accepts a name anda phone number from the user and provides buttons for parsing the name and editing the phone number 2. Add code to parse the name when the user enters a name and clicks the Parse Name button. This code should work whether the user enters a first, middle, and last name or just a first and last name. It should also convert the parsed name so the first letters are uppercase but the other letters are lowercase. The results should be displayed in a message box like this Parse Name First name Middle name Last name: Joel Ray Murach OK 3. Test the application to see if it works. Try entering the name in all uppercase letters or all lowercase letters to make sure the parsed name is still displayed with only the first letters capitalized. When you're done, close the form Add code to edit a phone number 4. Add code to edit the phone number when the user enters a phone number and clicks the Edit Phone Number button. This code should remove all special characters from the user entry so the number consists of 10 digits. Then, format the phone number with hyphens. These results should be displayed in a message box like the one that follows. For simplicity, you can assume that the user enters ten digits Edit Phone Number Entered: Digits only Standard format: (559) 440-9071 5594409071 559-440-9071 OK 5. Test the application with a variety of entry formats to make sure it works When you're done, close the form and then close the solution

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

More Books

Students also viewed these Databases questions

Question

What is an RFP and why do companies use them?

Answered: 1 week ago

Question

Write a letter asking them to refund your $1,500 down payment.

Answered: 1 week ago