Design an algorithm (no code) just using if-then statement

Assignment Help Data Structure & Algorithms
Reference no: EM13950600

Design an algorithm (no code) just using if-then statement or while statement generically, that validates a US phone number in the form of (xxx) xxx-xxxx.

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.

Develop an algorithm to verify if a string of characters could represent a valid U.S. phone number. Since 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.

The 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.

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.

Reference no: EM13950600

Questions Cloud

Who is attempting to teach without inspiring the pupil : A teacher who is attempting to teach without inspiring the pupil with a desire to learn is hammering on cold iron." - Horace Mann
How can business move from mail order to online presence : Apply ethical research and inquiry skills and demonstrate an understanding of the social impact of information technology and the need for security, privacy and ethical implications in information systems usage
Surroundings and the effects of motion and gravity : A pump operating at steady state takes in saturated liquid water at 65 lbf/in.2 at a rate of 10 lb/s and discharges water at 1000 lbf/in.2 The isentropic pump efficiency is 80.22%. Heat transfer with the surroundings and the effects of motion and ..
What qualities would you expect the firm : Would there be a universal list, or would lists differ on a country-by-country basis? what qualities would you expect the firm to be seeking in these managers?
Design an algorithm (no code) just using if-then statement : 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..
Prepare consolidated income statements for solvent company : Prepare consolidated income statements including the distribution of income to the controlling and noncontrolling interests for 20X1 and 20X2.
Power developed by the turbine : Water vapor at 6 MPa, 600°C enters a turbine operating at steady state and expands adiabatically to 10 kPa. The mass flow rate is 2 kg/s and the isentropic turbine efficiency is 94.7%. Kinetic and potential energy effects are negligible. Determine..
What is the apr earned on the account : You and your spouse recently purchased a 300,000 home with 75,000 down, and financing the rest using a 30-year mortgage with a nominal interest rate of 4.25%. Mortgage payments are made at the end of each month. How much of the first 3 years of mo..
Short biography of web du bois : What Should Education Teach- W.E.B. Du Bois was the first African American to earn a doctorate from Harvard. He fought for African American rights and cofounded the NAACP. Du Bois sought social, economic and political reforms to expand equality an..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Finding total available storage capacity

A certain hard disk has 480 cylinders, sixteen tracks, and thirty-two sectors of 512 bytes each. It spins at 4800 revolutions per minute, and has an adjacent cylinder seek time of eighty msec, and a max seek time of onde hundred msec.

  Question about lan and wan

Think about the following two scenarios two computers are connected to a LAN using a total of 20-feet of cable, and two computers are connected over the Internet and are 8000 miles from each other.

  Illustrate how b-tree will expand

Illustrate how tree will expand (after inserting each Part#), and what the final tree would like. (b) Repeat item (a), but use a B-tree of order p = 4 instead of a B+-tree.

  Portfolio website containing thumbnail imagery

Explain in general terms what you think the role of good design is. Next, recognize 3-characteristics of an effective gallery website. Then find an example of a portfolio website containing thumbnail imagery.

  Binary multiplication using booths algorithm

Perform the subsequent 4-bit binary multiplication using Booth's algorithm, assuming signed two's complement integers:

  Input a list of employee names and salaries and determine

input a list of employee names and salaries and determine the meanaverage salary as well as the number of salaries

  Construct the arraylisttype class

objective will be to construct your first list data structure using an array.

  Construct two gene expression clustering algorithms using r

CLUSTERING GENE EXPRESSION DATA USING R LANGUAGEConstruct two gene expression clustering algorithms using R.Select the best algorithm and construct a third improved algorithm.

  Does a min-weight edge on every cycle

Consider that a graph has distinct edge weights. Does its lightest edge have to belong to the MST

  Class to write computer games that have animated sprites

The Ucigame (pronounced 00-see-GAH-me) framework is designed to enable novice programmers to create 2D computer games in Java.

  Quality building supply qbs has proposed a project to

quality building supply qbs has proposed a project to develop a business system. the project team has gathered the

  Calculate the total weights and values of each subset

Use the decrease-by-one technique to generate the power set and calculate the total weights and values of each subset, then find the largest value that fits into the knapsack and output that value.

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