Implement a java program that reads phone numbers

Assignment Help JAVA Programming
Reference no: EM13940717

Implement a Java program that reads phone numbers, and for each phone number, it displays the phone number's three components - country code, area code, and local number.

Assume that the user enters each phone number as a series of digits and dashes, such that there are three groups of digits and two dashes separating the three groups. For example, 1-816-7412000. The first digit group (1 in the example) is the country code, the second digit group (816 in the example) is the area code, and the third digit group (7412000 in the example) is the local phone number.

Do not assume that the number of digits in a particular digit group is fixed. For example, the country code for the United States requires one digit (1) and the country code for China requires two digits (86).

A sample session would look like following.

PHONE NUMBER DISSECTOR

Enter a phone number in the form cc-area-local,
where cc = country code digits, area = area code digits,
and local = local phone digits.
Or enter q to quit:
1-816-7412000

country code = 1
area code = 816
local phone number = 7412000

Enter a phone number in the form cc-area-local,
where cc = country code digits, area = area code digits,
and local = local phone digits.
Or enter q to quit:
86-131-12345678

country code = 86
area code = 131
local phone number = 12345678

Enter a phone number in the form cc-area-local,
where cc = country code digits, area = area code digits,
and local = local phone digits.
Or enter q to quit:
Q
Press any key to continue . . .

Reference no: EM13940717

Questions Cloud

What are the classifications of operating assets : What are the classifications of operating assets? How do they differ from one another? How does the cost concept affect accounting for operating assets? Under this concept, what is included in the cost of a fixed asset?
Business sustainability report for gorilla health bars : Write a 1, 000-word Business Sustainability Report for Gorilla Health Bars CEO Janet Jones, in which you make specific recommendations, based on your research, about how the company can become more sustainable.
How would your resolution be enforced : How would your resolution be enforced? In other words, what if Johnson doesn't live up to his agreement? Why you think your resolution is a better alternative for all concerned than a traditional punishment?
Calculate the rate per square foot for warehousing : Calculate the rate per square foot for Warehousing. Calculate the traceable fixed costs for each division and for each product in the Clothing division
Implement a java program that reads phone numbers : Implement a Java program that reads phone numbers, and for each phone number, it displays the phone number's three components - country code, area code, and local number.
Is banishment more humane than corporal punishment : Why might a society choose banishment as a way of dealing with criminals rather than corporal or capital punishment? Is banishment more or less humane than corporal or capital punishment? Explain your answer
Explain the purpose of tqm : Define and explain the purpose of TQM. What elements within a manufacturing environment need to be reduced or eliminated as part of a Lean Manufacturing focus?
Risk management program for an organisation : This project entails you planning, conducting and evaluating a risk management program for an organisation. For the purpose of this project, the term organisation can include a small business, work team or division in a large organisation, sportin..
What fundamental assumptions of career criminal programs : What are some of the fundamental assumptions of career criminal programs? What limitations might these assumptions present in our efforts to identify and punish career criminals?

Reviews

Write a Review

JAVA Programming Questions & Answers

  You will need a bottomuptwothreefourtree class with a

you will need a bottomuptwothreefourtree class with a bottomuptwothreetreefourtree constructor which takes no

  Writing programs for mobile devices with the java language

Discuss considerations in writing programs for mobile devices with the Java language

  How are servlets and jsps deployed inside weblogic

How are Servlets and JSP's deployed inside WebLogic? In a Weblogic CMP EJB, how to obtain the maximum value in the specified database column? In WLQL is there something similar to MAX() function in SQL?

  Describe the behavior of the java class

The authors initially describe the behavior of the java.util.Hashmap class. As they describe it, the Java implementation of a Hash Map consists of a table (bucket array) of entries. Each entry consists of a K, V pair with the addition of a next re..

  Write a program that converts date formats

Write a program that prompts the user to input an integer between 0 and 35. If the number is less than or equal to 9, the program should output the number; otherwise, it should output A for 10, B for 11, C for 12,..., Z for 35. (Hint: use the case..

  Create a package called people

Create a second package called ‘task01'. Within this package provide classes which perform the following tasks.

  User interface menu using doubly linked lists

Each mNode defines the main menu item name, two links to its mNode neighbors (the previous and next mNode) and a link to its first submenu node.

  Design an object-oriented java application

You are to design an object-oriented Java application to let the user play a dice game that uses two dices. The player bets on a value and the dices roll

  Java program to implement currency converter

Write a JAVA program that helps the user convert currency. The user will enter the amount in Kuwaiti dinars. The program will print the equivalent amount in US dollar and Euros count his change.

  Java program that prompts for the gpa

This assignment will give you practice with interactive programs, if/else statements and methods that return values. Your program will prompt the user for information about two applicants and compute an overall score for each applicant. This is ..

  Graphics program that draws 12 strings

Write a graphics program that draws 12 strings, one each for the 12 standard colors, besides Color.WHITE, each in its own color. Provide a class ColorNameViewer and a class ColorNameComponent.

  Write a restful web service demo example using spring mvc

Write a restful web service demo example using spring mvc

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd