Question
I am stuck for this. I understand the what I need to do but I am having trouble typing it out Write the class, PhoneNumber.java
I am stuck for this. I understand the what I need to do but I am having trouble typing it out
Write the class, PhoneNumber.java. Do the following: 1. Create three instance variables, countryCode, areaCode and number, all of which should be Strings. 2. Write the default constructor. 3. Write the non-default constructor. 4. Write 3 accessor methods, one for each instance variable. 5. Write 3 mutator methods, one for each instance variable. 6. Write a method that will return the entire phone number as a single string (the toString method). 7. Write a method that will return true if the areaCode is 3 characters long. 8. Write a method that will return true if the number is 7 characters long. 9. Optional: 7 and 8 return true if the areaCode is 3 digit characters long and the number is 7 digit characters long. 10. Now write an application class that instantiates two instances of PhoneNumber. One instance should use the default constructor and the other should use the non-default constructor. Display the values of each object by calling the toString method.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started