Question: 2.29 Random Phone Number (Java) Write a program that creates and prints a random phone number of the form 668-555-xxxx where xxxx is a 4-digit

2.29 Random Phone Number (Java)

Write a program that creates and prints a random phone number of the form 668-555-xxxx where xxxx is a 4-digit randomly generated number. Include the dashes in the output. Think through how you can guarantee a 4-digit number.

Your output should look like:

A random phone number: 678-555-1234

Given:

import random number

public class PhoneNumbers { //----------------------------------------------------------------- // Produces a random phone number of the form 678-555-xxxx. //-----------------------------------------------------------------

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!