Customer Service Chat
Get quote & make Payment
Intro to Programming, JAVA Programming
Every phone number is broken up into sections as shown below:
Country Code Area Code Prefix Line Number
1 919 882 5000
Write a program to separate out a phone number when it is given with colon’s separating the sections.
Your driver class should contain the following main method: (add comments)
public static void main(String args)
YIDissector phone = new YIDissector("1:919:882:5000");
} // end main
Implement a YourInitialsDissector.java class that stores the phone number as a colon separated string of numbers and as four separate pieces described below.
You must implement all of the following:
colonSeparated – a colon separated String. Example value: "1:919:882:5000"
countryCode – stored as a String as it could hold 001
areaCode, prefix, number – stored as int variables
Constructor: This constructor receives one parameter, a colon-separated string. You may assume that the parameter’s value is valid (i.e., no error checking required). The constructor initializes the instance variables with appropriate values. There are many ways to solve the problem of extracting the sections from the given colon separated string. You are required to use String methods to extract the individual sections as strings, and then use parseInt method calls to convert the strings to int’s for those that need it. Do NOT use split as it has not been covered yet.
getPhoneNumber method with no arguments:
This is a standard accessor method that simply returns the colonSeparated instance variable’s value.
getPhoneNumber method with integer argument:
This method receives the position of one of the section (1, 2, 3, or 4) and returns the section that’s at that position. Area Code is 1, etc.
When using the main method specified above, your output should be:
Posted Date: 10/23/2012 6:34:52 AM | Location : United States
Ask an Expert
Intro to Programming, Assignment Help, Ask Question on Intro to Programming, Get Answer, Expert's Help, Intro to Programming Discussions
Write discussion on Intro to Programming
Your posts are moderated
Write your message here..
Rfid based student attendance system include biometrics, Develop a rfid bas...
Develop a rfid based student attendance system include biometrics Project Description: The aim of our project is using rfid technology student attendance has to be taken. whe
Polymorphism, Polymorphism - defines the ability of a single variable of ...
Polymorphism - defines the ability of a single variable of a provided type to be used to reference objects of different types, and automatically call the method that is specific
What is the difference between SOA and a Web Service, Normal 0 ...
Normal 0 false false false EN-US X-NONE X-NONE
PadovanString, write a program that counts the number of occurrences of the...
write a program that counts the number of occurrences of the string in the n-th Padovan string P(n). program in java // aakash , suraj , prem sasi kumar kamaraj college
I want fitlife app for android - ios, I want FitLIFE app for Android, IOS, ...
I want FitLIFE app for Android, IOS, Windows Project Description: Hello, I want to develop an app for Android, IOS and Windows Phone. This app will be work with open source B
Difference between ejb 2.0and ejb 1.1, EJB 2.0 has the additional advantage...
EJB 2.0 has the additional advantages over the EJB 1.1 given below 1. Local interfaces : These are beans that can be needed locally, that means by the same Java Virtual Machi
Explain what is local variable, Explain what is Local Variable ? Declar...
Explain what is Local Variable ? Declaring variables (using the var keyword) inside a function forms them local. They are available only inside the function and hold no meaning
Explain the relational operator precedence, Explain the Relational Operator...
Explain the Relational Operator Precedence ? Whenever a new operator is introduced you have to ask yourself whereas it fits in the precedence tree. If you seem back at the ins
For what purposes ftp is used in networks, For what purposes FTP is used in...
For what purposes FTP is used in networks? FTP is known as file transfer protocol it is basically used to download or upload files / data to a remote computer.
What information is needed to create a tcp socket, The Local Systems IP Add...
The Local Systems IP Address and Port Number and the Remote System's IPAddress and Port Number.
Accounting Assignment Help
Economics Assignment Help
Finance Assignment Help
Statistics Assignment Help
Physics Assignment Help
Chemistry Assignment Help
Math Assignment Help
Biology Assignment Help
English Assignment Help
Management Assignment Help
Engineering Assignment Help
Programming Assignment Help
Computer Science Assignment Help
IT Courses and Help
Why Us ?
~24x7 hrs Support
~Quality of Work
~Time on Delivery
~Privacy of Work
Human Resource Management
Literature Review Writing Help
Follow Us |
T & C
Copyright by ExpertsMind IT Educational Pvt. Ltd.