Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

    

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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Sure Heres a program in C that meets your requirements cpp include iostream using namespace std bool ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions