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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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