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..
Implement design in the java programming language, Implement your design in...
Implement your design in the Java programming language. Your main program file must be called MIPSim.java. Your simulator should implement the MIPS instruction set with the rest
Name conflicts when importing packages, Name Conflicts when importing packa...
Name Conflicts when importing packages It is possible which you will try to import a package which contains classes in which have the similar name as a class in your own source
What is methods in java explain with an example, What is Methods in java ex...
What is Methods in java explain with an example? Data types aren't much use unless you can do things along with them. For this reasons classes have techniques. Fields say what
Explain different way of using thread, Explain different way of using threa...
Explain different way of using thread? The thread could be executed by using runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cau
Indeed api integration and search bar fix, Indeed API integration and searc...
Indeed API integration and search bar fix (Java, Wordpress and PHP) I start a job portal on WP developed out of a customized template. We need an expert in integrating Indeed AP
Mid-Square hashing, how can i implement Mid-Square hashing?
how can i implement Mid-Square hashing?
N-th padovan string p(n), write a program that count the number of occurenc...
write a program that count the number of occurences of string in the n-th padovan string p(n) program in java // aakash , suraj , prem sasi kumar kamaraj college progr
Small projects, i am doing java and want projects with solutions to practic...
i am doing java and want projects with solutions to practice more and more
Explain how several ways businesses monitor their employees, Explain how se...
Explain how several ways businesses monitor their employees? Systems are available in which monitor or most every key stroke which an employee forms on computer. Systems are av
Program on while and until loop, Question Based on the program fragmen...
Question Based on the program fragment below, rewrite the outer for loop using: a. while loop b. repeat..until loop
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
Why Us ?
~24x7 hrs Support
~Quality of Work
~Time on Delivery
~Privacy of Work
Human Resource Management
Literature Review Writing Help
Terms & Conditions
Copyright by ExpertsMind IT Educational Pvt. Ltd.