Designing a string-checking algorithm

Assignment Help Data Structure & Algorithms
Reference no: EM13948923

Designing a String-Checking Algorithm

In many situations, information is supplied as a string of text characters. The characters of that information may need to be in a particular format to be valid. Common examples include credit card numbers, e-mail addresses, dates, and telephone numbers.

In this Application, you will develop an algorithm to verify if a string of characters could represent a valid U.S. phone number.

Determining whether a string of characters is actually a valid phone number is a complex process. Therefore, you will determine only if the characters in the string appear in a format appropriate for such a phone number.

Perform the following tasks:

1. Design an algorithm to determine if an input string is in a format appropriate for a U.S. phone number. Your algorithm should accept any string in the form (xxx) xxx-xxxx, where x represents a digit and the other characters represent themselves, and reject all others. For this algorithm, you can determine the total number of characters in the string and inspect the value of one character at a time.

2. Provide an example of an input string that is in the proper format and an example that is not in the proper format. Describe how your algorithm determines that the first string is in the proper format and that the second string is not in proper format.

3. Describe your algorithm clearly and precisely.

Reference no: EM13948923

Questions Cloud

Compute the budgeted divisional roi for the air conditioner : Compute the ROI for each investment project. Compute the budgeted divisional ROI for The air conditioner investment is made.
What principles of distributive negotiation did sherman use : Based on the above reading and the knowledge gained from your assigned readings, respond to the following questions: What principles of distributive negotiation did Sherman use to gain his advantage? Do you think Sherman behaved ethically? Why or why..
How much higher or lower is this intensity compared : How much higher or lower is this intensity compared to the 100 keV beam penetration 20 cm of soft tissue - how much higher would the incident intensity, in photons/mm2, need to be for the 20 KeV beam than with the 100 KeV beam?
Change in dividend than with actual amount of dividend : Dividends tend to fluctuate in direct relation to changes in annual earnings. Managers are less concerned with the change in the dividend than with the actual amount of the dividend. Managers tend to avoid smooth dividends as they don't signal the fi..
Designing a string-checking algorithm : Provide an example of an input string that is in the proper format and an example that is not in the proper format. Describe how your algorithm determines that the first string is in the proper format and that the second string is not in proper fo..
Calculate the roi for the division without the investment : Compute the ROI for the division without the investment. Compute the margin and turnover ratios without the investment. Show that the product of the margin and turnover ratios equals the ROI computed in Requirement 1.
Determine the velocity and acceleration of point : The disk rotates about the shaft S, while the shaft is turning about the z axis at a rate of vz = 4 rad>s, which is increasing at 2 rad>s2. Determine the velocity and acceleration of point A on the disk at the instant shown. No slipping occurs.
Define two applications or cases of game theory in business : The companies can only offer one of three possible plans. One of the companies (South Wireless) contracted a market study to estimate the potential number of customers under each circumstance.
Advantage and disadvantage of your chosen training methode : Recommend a specific employee training method that you think would be most effective for a healthcare organization, and determine one advantage and one disadvantage of your chosen training method. Provide support for your rationale

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Data systems and design

Suppose if you have a program with a housekeep() module, a mainloop() module, and a finishup() module, when is the second input record usually read?

  Normalized relations for a database

Suppose that a information communications network links a computer at corporate headquarters with a computer in each retail outlet. The chain includes fifty stores with an average of 75 workers per store.

  How to store and reference data in an array list

How to store and reference data in an array list and How to delete data from the ArrayList

  Part 1 - report write a 2000-word report that describes a

part 1 - report write a 2000-word report that describes a suitable methodology from the literature for the purpose of

  What are the benefits of linked lists and objects in

what are the advantages of linked lists and objects in program development and design? how does python utilize these

  Find the minimum cost path from a designated node

Find the Minimum Cost Path from a designated start node to a designated destination node in a graph.

  Show how the box can be used to factor n

That is, given a quadratic residue y, the box outputs an x with x2 = y (equation is modulo n). Show how the box can be used to factor n.

  How the two versions of the algorithm compare

A brief introduction of the sorting algorithm that you have selected and how the two versions of the algorithm compare.

  Design algorithm to read a file of employee records

Design an algorithm and souce code C++ that will read a file of employee records and produce a weekly report of gross earnings for those employees.

  Describe ambiguity in proposed algorithm

Describe the distinction between an ambiguity in a proposed algorithm and an ambiguity in the representation of an algorithm. Describe how the use of primitives helps remove ambiguities in an algorithm's representation.

  Design a algorithum

Design a algorithum

  Create a flowchart to determine the cause of problems

Assume you are the 1st level help desk technician at a average sized corporations. Your job is to handle the initial calls from corporation  computer users with personal computer related problems.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd