2. Write a program that constructs a random telephone number of the form (XXX) XXX-XXXX and outputs a formatted string (parentheses and dashes included) according to the following rules: The first 3 digits may not contain an 8 or 9. The second set of three digits must be larger than 100 and less than 888. a. b. You must construct the desired string (using Random class) and then output it accordingly. Until you are confident in your code, seed the random number generator with 0. For example, (777)-101-0000 is a valid number.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Can you give me two ways to do it

Assignment
View Feedb
2. Write a program that constructs a random telephone number of the form (XXX) XXX-XXXX and
outputs a formatted string (parentheses and dashes included) according to the following rules:
The first 3 digits may not contain an 8 or 9.
b. The second set of three digits must be larger than 100 and less than 888.
a.
You must construct the desired string (using Random class) and then output it accordingly. Until
you are confident in your code, seed the random number generator with 0.
For example, (777)–101-0000 is a valid number.
6:2
9/12
67°F Clear
EN
立
Transcribed Image Text:Assignment View Feedb 2. Write a program that constructs a random telephone number of the form (XXX) XXX-XXXX and outputs a formatted string (parentheses and dashes included) according to the following rules: The first 3 digits may not contain an 8 or 9. b. The second set of three digits must be larger than 100 and less than 888. a. You must construct the desired string (using Random class) and then output it accordingly. Until you are confident in your code, seed the random number generator with 0. For example, (777)–101-0000 is a valid number. 6:2 9/12 67°F Clear EN 立
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education