Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Numbers displayed on the screen must be formatted for readabiity. Think of your phone number, or Social Security number and Credit Card. Write a program

Numbers displayed on the screen must be formatted for readabiity. Think of your phone number, or Social Security number and Credit Card. Write a program that uses a Scanner to take a single user input.

If the user enters 9 characters format it as a Social Security Number. It should appears as 123-45-6789 (must have dashes) If the user enters 10 characters format it as a phone number. It should appears as (123)456-7890 (parentheses around area code and a dash. If the user enters 16 characters format it as a credit card number. It should appears as 1234 5678 9012 3456 (use spaces every 4 digits)

The user must enter input all required digits (0..9) and the input must have a length of 9, 10 or 16. If not display an appropriate error message.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

Students also viewed these Databases questions

Question

Why does sin 2x + cos2x =1 ?

Answered: 1 week ago

Question

What are DNA and RNA and what is the difference between them?

Answered: 1 week ago

Question

Why do living creatures die? Can it be proved that they are reborn?

Answered: 1 week ago