APlusGrades

Not Rated (0)

$15/per page/Negotiable

About APlusGrades

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing,Foreign Languages,Geography,Geology,Health & Medical,HR Management,Law,Management,Physics,Programming,Science,Statistics Hide all
Teaching Since: Jul 2017
Last Sign in: 270 Weeks Ago, 6 Days Ago
Questions Answered: 1850
Tutorials Posted: 1850

Education

  • Graduate in Biology and Nutrition, MBA Finance
    Florida State University
    Aug-2000 - Jul-2007

Experience

  • Ass. Relationship Manager
    Penn-Florida
    Mar-2009 - Feb-2016

Category > Computer Science Posted 18 Jul 2017 My Price 12.00

Your program should prompt a user

  • Your program should prompt a user to enter a social security number (SSN) as a series of digits.
  • It will check whether the user entered a valid 9-digit SSN and report an error message if the SSN entered is too short or too long or if the user enters a non-numeric input.
  • It should report a specific error message for each of the three possible errors listed in the bullet point above.
  • If the user makes a mistake, the program should re-prompt the user using a loop (suggestion: do-while loop).
  • Once the user enters a valid input, the program will display the SSN in the the format XXX-XX-XXXX
  • You are required to write a function with the following signature to check whether the user entered a numerical SSN (i.e. whether all of the digits entered were numerical). If the user enters any other character besides 0-9, return false, otherwise return true. Hint: Use ASCII
  • Copy and paste the below prototype above main and then write the function below main.

bool isNumeric(string SSN);

//use ASCII to determines if a string contains only the characters 0-9

  • You are also required to have a function with the following signature to display the SSN. 
  • Copy and paste the below prototype above main and then write the function below main.

void displayFormattedNumber(string SSN);

//Calls the formatSSN function and then displays it to the console

//With the message "You entered: " followed by the SSN

string formatSSN(string SSN);

//helper function to displayFormatted SSN

//converts a 9 character string into an SSN in the format XXX-XX-XXXX

 

  • Your program should work identically to example below:

Please enter a 9-digit SSN (no spaces no punctuation): 12345

You entered too few digits. Please try again.

 

Please enter a 9-digit SSN (no spaces no punctuation): 123456789012345

You entered too many digits. Please try again.

 

Please enter a 9-digit SSN (no spaces no punctuation): 123 456

You entered too few digits. Please try again.

 

Please enter a 9-digit SSN (no spaces no punctuation): 123 456 7890

Please enter a number with no spaces or punctuation. Please try again.

 

Please enter a 9-digit SSN (no spaces no punctuation): 123-45-6789

Please enter a number with no spaces or punctuation. Please try again.

 

Please enter a 9-digit SSN (no spaces no punctuation): 123456789

You entered: 123-45-6789

 

  • It is strongly suggested to structure your main function like this:

bool not_valid_SSN = true;

do {

    //user input

    if (test for too short) {

       //display appropriate error message

    } else if (!is_numeric(SSN)) {

       //display error message

    } else if(test for too long) {

       //display appropriate error message

    } else {

       //display appropriate formatted phone number

       not_valid_SSN = false;

    }

} while(not_valid_SSN);

Answers

Not Rated (0)
Status NEW Posted 18 Jul 2017 03:07 PM My Price 12.00

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â-----------  -----------Tha-----------nk -----------you----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m Â----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I

Not Rated(0)