EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 7, Problem 9PE

Explanation of Solution

Program:

File name: “PhoneNumberFormat.java

//Import necessary header files

import java.util.Scanner;

//Define a class named PhoneNumberFormat

public class PhoneNumberFormat

{

    //Define main method

    public static void main(String args[])

    {

        //Create an object for the Scanner class

        Scanner scanner = new Scanner(System.in);

        //do..while loop

        do

        {

            //Prompt the user to enter a Phone Number

            System.out.print("\nEnter the Phone Number: ");

            String textPhone = scanner.nextLine();

 /*Continue to accept the user input until the user enters 999*/

            if (textPhone.contains("999"))

                break;

            //If the user enters a ten-digit phone number

            if (textPhone.matches("[0-9]+") && textPhone.length() == 10)

            {

                //Print the result

                System...

Blurred answer
Students have asked these similar questions
Program62.javaWrite a program that prompts for a full name (first and last) and assigns it to one string. The program then passes the full name to a void method as its sole parameter. The void method should print the first name, on one line, as many times as indicated by the length of the last name. Sample Output (image below)
write an application that reads English-Language phrase and encodes it into morse code. also write an application that reads a phrase in morse code and converts it into the English-Language equivalent . Use one blank between each Morse-code letter and three blanks between each Morse-coded word.
Code with comments and output screenshot is must for an Upvote. Thank you! Using Java: Create a random 2000-digit number and store it in a file. Read the number from the file and find the smallest number within our larger number that contains at least every digit. For instance,149485420251367 contains every digit, but 94556780231 is a smaller number that contains every digit.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License