Write a program that gets a string from the user and determines whether the string is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that gets a string from the user and determines whether the string is a valid social security number in DDD-DD-DDDD format, where the D's are the digits 0 - 9. Your program must consist of at least three functions besides main. There can be more than three. One of the functions will take a single character as its only argument and return true when the character is a dash and false otherwise. Another of the functions will take a single character as an argument and return true when the character is a digit in the range 0-9 and false otherwise. You must code the functionality yourself (don't search out and use a library function). Hint: See Demo_isAlphaNum.cpp. Please note, the definition of a function (not the prototype) must have a comment above that explains what the function does, what arguments it takes/inputs it gets, and what value it returns/other outputs it produces. Sample output of a program that satisfies the requirements is shown below. The data entered by the user is in blue. Sample Output 1: Enter the employee's social security number: 012-34-5678 012-34-5678 is in valid format. Sample Output 2: Enter the employee's social security number: 999-99-999 999-99-999 is not in valid format.. Sample Output 3: Enter the employee's social security number: 978-0001111 978-0001111 is not in valid format. Write a program that gets a string from the user and determines whether the string is a valid social security number in DDD-DD-DDDD format, where the D's are the digits 0 - 9. Your program must consist of at least three functions besides main. There can be more than three. One of the functions will take a single character as its only argument and return true when the character is a dash and false otherwise. Another of the functions will take a single character as an argument and return true when the character is a digit in the range 0-9 and false otherwise. You must code the functionality yourself (don't search out and use a library function). Hint: See Demo_isAlphaNum.cpp. Please note, the definition of a function (not the prototype) must have a comment above that explains what the function does, what arguments it takes/inputs it gets, and what value it returns/other outputs it produces. Sample output of a program that satisfies the requirements is shown below. The data entered by the user is in blue. Sample Output 1: Enter the employee's social security number: 012-34-5678 012-34-5678 is in valid format. Sample Output 2: Enter the employee's social security number: 999-99-999 999-99-999 is not in valid format.. Sample Output 3: Enter the employee's social security number: 978-0001111 978-0001111 is not in valid format.
Expert Answer:
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Microkernel operating systems aim to address perceived modularity and reliability issues in traditional "monolithic" operating systems. (i) Describe the typical architecture of a microkernel...
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
Access various employment Web sites (for example, www.monster.com and www.dice.com ) and find several job descriptions for a database administrator. Are the job descriptions similar? What are the...
-
Who really owns a corporation, and how does that impact the goal of the firm?
-
Explain carefully what is meant by the expected price of a commodity on a particular future date. Suppose that the futures price of crude oil declines with the maturity of the contract at the rate of...
-
Indicate the flow of sales orders and sales invoices in the manual execution of sales transactions.
-
Bilboa Freightlines, S.A., of Panama, has a small truck that it uses for intracity deliveries. The truck is worn out and must be either overhauled or replaced with a new truck. The company has...
-
What considerations should be taken into account when applying trauma-informed approaches to conflict resolution, and how can practitioners create safe and supportive environments for individuals who...
-
Halifax Manufacturing allows its customers to return merchandise for any reason and receive a credit to their accounts. All of Halifax's sales are for credit (no cash is collected at the time of...
-
11. A 5-kg block is given a shove so that it starts to slide to the right in Figure 2 across a rough, horizontal surface at an initial speed of u = 4.0 m/s. If the coefficient of sliding friction =...
-
Why is the compressed adjusted present value approach appropriate for situations with a changing capital structure?
-
Explain how a new firms receivables balance is built up over time.
-
How would a shift from a tight credit policy to a relaxed policy be likely to affect a firms cash budget?
-
If a firm can structure a project such that expenditures can be made in stages rather than all at the beginning, how would this affect the projects risk and expected NPV? Explain.
-
What is a supply chain, and how are supply chains related to justin- time inventory procedures?
-
Let the capacitance of the reverse based pn-junctions be CJ0 C= "B po The capacitance of the pn-junctions consists of two parts: DC-induced part C, and AC-induced AC with AC
-
Explain the term "Equivalent Units". Why are they calculated in process costing? [4 Marks] [minimum 350 words]
-
Create a class that will bundle together several static methods for tax computations. This class should not have a constructor. Its attributes are basicRatethe basic tax rate as a static double...
-
Repeat Programming Project 7, but write the program as JavaFx application. Use a constant for the initial velocity of the ball. Draw a circle for the position of the ball at each second. The...
-
Derive a class ExaggeratingKid from SchoolKid, as described in the previous exercise. The new class should override the accessor method for the age, reporting the actual age plus 2. It also should...
-
A mass attached to a linear spring sliding on a surface with Coulomb damping is an example of a nonlinear system. Indicate whether the statement presented is true or false. If true, state why. If...
-
The swinging spring is an example of a two degree-of-freedom system with a cubic nonlinearity. Indicate whether the statement presented is true or false. If true, state why. If false, rewrite the...
-
The convolution integral can be applied to solve nonlinear problems. Indicate whether the statement presented is true or false. If true, state why. If false, rewrite the statement to make it true.
Study smarter with the SolutionInn App