Please write code in C++. Thanks Lab #09 Flowchart Many websites ask for phone numbers. The problem
Fantastic news! We've Found the answer you've been seeking!
Question:
Please write code in C++. Thanks
Transcribed Image Text:
Lab #09 Flowchart Many websites ask for phone numbers. The problem is that there are many ways to represent a phone number. Examples include 817-555-1234, 817 555 1234 (c), and (817) 555-1234 x23. Write a Raptor program which inputs a string containing a US phone number in any format and outputs it in the international standard format. The international standard for US phone numbers is - +1 817 555 1234 There should be a single space after the +1, and after the third and sixth digits of the US number. Your Raptor program should: 1. Input a string including the number 2. Copy only the digits from the input string into another string 3. Issue an error message if the input string does not contain at least 10 digits 4. If the input string contains more than 10 digits, include only the first 10 digits in the formatted number 5. Output the phone number in standard format Hints: 1. In Raptor, a string is just an array of characters. 2. Lesson #9 has an example of working with strings in Raptor. 3. When only digits are input, Raptor assumes it is an integer instead of a string. Your flowchart does not need to properly handle an input like 8175551234, but your C++ version does need to handle that. 4. I recommend passing the digits only string to a procedure which outputs it in the standard format. Sample Output (inputs in bold) Please enter a phone number: 817-555-1234 The properly formatted number is +1 817 555 1234 Please enter a phone number: (817)515 7259 x23 The properly formatted number is +1 817 515 7259 Please enter a phone number: 214-555-999 The phone number must have at least 10 digits Please enter a phone number: 800**4444xxx333 The properly formatted number is +1 800 444 4333 Lab #09 Flowchart Many websites ask for phone numbers. The problem is that there are many ways to represent a phone number. Examples include 817-555-1234, 817 555 1234 (c), and (817) 555-1234 x23. Write a Raptor program which inputs a string containing a US phone number in any format and outputs it in the international standard format. The international standard for US phone numbers is - +1 817 555 1234 There should be a single space after the +1, and after the third and sixth digits of the US number. Your Raptor program should: 1. Input a string including the number 2. Copy only the digits from the input string into another string 3. Issue an error message if the input string does not contain at least 10 digits 4. If the input string contains more than 10 digits, include only the first 10 digits in the formatted number 5. Output the phone number in standard format Hints: 1. In Raptor, a string is just an array of characters. 2. Lesson #9 has an example of working with strings in Raptor. 3. When only digits are input, Raptor assumes it is an integer instead of a string. Your flowchart does not need to properly handle an input like 8175551234, but your C++ version does need to handle that. 4. I recommend passing the digits only string to a procedure which outputs it in the standard format. Sample Output (inputs in bold) Please enter a phone number: 817-555-1234 The properly formatted number is +1 817 555 1234 Please enter a phone number: (817)515 7259 x23 The properly formatted number is +1 817 515 7259 Please enter a phone number: 214-555-999 The phone number must have at least 10 digits Please enter a phone number: 800**4444xxx333 The properly formatted number is +1 800 444 4333
Expert Answer:
Answer rating: 100% (QA)
include include using namespace std string formatPhoneNumberstring input Copy only digits from input ... View the full answer
Related Book For
Fundamentals of Cost Accounting
ISBN: 978-0077398194
3rd Edition
Authors: William Lanen, Shannon Anderson, Michael Maher
Posted Date:
Students also viewed these programming questions
-
Please write a C Code for this problem. Please do not submit C++ or Python Code.
-
Code Force Problem 1311B: https://codeforces.com/problemset/problem/1311/B Please write a C code for this question.
-
Code Force Problem 1133C: https://codeforces.com/problemset/problem/1133/C Please write a C code for this question. C. Balanced Team time limit per test: 2 seconds memory limit per test: 256...
-
The rotational velocity of a spinning disk decreases from 6 rev/s to 3 rev/s in a time of 12 s. What is the rotational acceleration of the disk?
-
What are some types of complexity that are affecting logistics activities in a firm?
-
Cornering is an illegal practice, whereby speculators accumulate a significant amount of the underlying asset. When maturity is approached, the short positions will be forced to buy the asset at...
-
What do you know about the mathematical value of a project's internal rate of return under each of the following conditions? a. The present worth of the project is greater than 0 . b. The present...
-
1. List IKEAs external and internal challenges. Looking at IKEAs challenges, which ones do you think pose the greatest threat? Why? How would you address the challenges? 2. Walmart entered a period...
-
What will be the output of the following code snippet? (5 Puan) interface MyInterface3 { } public void myMethod (); abstract class MyAbstractClass3 { }) public abstract void myMethod (); class...
-
Activity-Based Product Costing Davis Company produces two hair dryers: regular and deluxe. The company has four activities: machining, engineering, receiving, and inspection. Information on these...
-
Tatsuo Corporation purchased farm equipment on January 1, 2019, for $299,000. In 2019 and 2020, Tatsuo depreciated the asset on a straight-line basis with an estimated useful life of five years and a...
-
The unadjusted trial balance of Simple Consulting Services as at December 31, 2021 is as follows: Cash Accounts receivable Prepaid insurance Supplies inventory Office equipment Accumulated...
-
create the post closing trial balance
-
Assume that Sally Williams desires to accumulate $1,000,000 in 15 years using her money market fund balance of $182,696. At what interest rate must Sally's investment compound annually? Interest rate...
-
Two masses are suspended by a cord that passes over a pulley with negligible mass. The cord also has negligible mass. One of the masses, m 1 , has a mass of 6.0 kg and the other mass, m2, has a mass...
-
A charged particle traveling in the y - direction with a momentum of 0 . 0 1 kg m/s enters a regions of space that has a uniform 1 Tesla magnetic. field in the z- direction as shown the Figure, If...
-
Cinnamon Buns Co. (CBC) began 2016 with $52,000 in merchandise available. During 2016, $280,000 in merchandise was purchased on account with a credit term of 2/10, n/30. All discounts were taken. All...
-
Find the radius of convergence in two ways: (a) Directly by the CauchyHadamard formula in Sec. 15.2. (b) From a series of simpler terms by using Theorem 3 or Theorem 4.
-
In the In Action feature, Using the Budget to Help Manage Cash Flow, smaller firms were more likely to find the budget extremely or very important than larger firms. Why might this be the case?
-
Organic Grounds produces two brands of coffee: Star and Bucks. The two coffees are produced in one factory using the same production process. The only difference between the two coffees is the cost...
-
Isadores Implements, Inc., manufactures pens and mechanical pencils often used for gifts. Overhead costs are currently allocated using direct labor-hours, but the controller has recommended an...
-
a. Find the Laplace transform of the given function. Use Table 2.2 when applicable. b. Confirm the result of (a) in MATLAB. \(t^{2} \sin \left(\frac{1}{2} t ight)\) TABLE 2.2 Laplace Transform Pairs...
-
a. Express the signal in terms of unit-step functions. b. Find the Laplace transform of the expression in (a) by using the shift on \(t\)-axis. \(g(t)\) in Figure 2.16 FIGURE 2.16 Signal in Problem...
-
a. Express the signal in terms of unit-step functions. b. Find the Laplace transform of the expression in (a) by using the shift on \(t\)-axis. \(g(t)\) in Figure 2.15 FIGURE 2.15 Signal in Problem...
Study smarter with the SolutionInn App