Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1: Repeated Input Validation This program should prompt the user (using the prompts shown below) to input three data fields: Name, Age, and Phone

image text in transcribed

Question 1: Repeated Input Validation This program should prompt the user (using the prompts shown below) to input three data fields: Name, Age, and Phone Number. Each field should be checked against these specifications: Name must be between 1 and 30 characters long, excluding any leading or trailing spaces. Age must be a number from 0-125 Phone number must be a sequence of exactly ten digits, with no leading zeros. . . If an input value does not meet its specifications, the program should display "Incorrect input" and then repeat the input process for that field only. Once all fields have been input correctly, the input values should be displayed in the format shown below Examples: Enter your name: John Smith Enter your age: 33 Enter your phone number: 5305551212 Name: John Smith Age: 33 Phone Number: 530 555 12 12 Enter your name: John Smith Enter your age: 1234 Incorrect input Enter your age: 45 Enter your phone number: 0053051212 Incorrect input Enter your phone number: 3 Incorrect input Enter your phone number: 5305551212 Name: John Smith Age: 45 Phone Number: 530 555 12 12 Notes: . The do-while loop is appropriate for repeated input validation. The String class method trim will remove leading and trailing spaces from a String

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_2

Step: 3

blur-text-image_3

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions