Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class TelephoneNumber Variables areaCode - three digit int exchangeCode - 3 digit int Number - four digit int Methods TelephoneNumber(aString) A constructor that

image text in transcribedCreate a class TelephoneNumber Variables areaCode - three digit int exchangeCode - 3 digit int Number - four digit int Methods TelephoneNumber(aString) A constructor that creates and returns a new instance o its class given a string in the form xxx-xxx-xxxx or xxx-xxxx. Throw an exception if the format is not valid toString - returns a string in either of the two formats shown preiouvlsy based on if it has an area code or not. Create a file with several telephone numbers varying between the 2 formats Write a program that reads the file displays the data on the screen and creates an array whose base type is telephone number Allow the user to add or delete 1 number Write the modieifed data back into the text file replacing the original contents Then read/display the file.

Java program preferred!!!!

Create a class TelephoneNumber 1. Variables 1. areaCode - three digit int 2. exchangeCode 3 digit int 3. Number - four digit int 2. Methods 1. TelephoneNumber(aString) 1. A constructor that creates and returns a new instance o its class given a string in the form xxxxx xxx or x xx-xxxx. 2. Throw an exception if the format is not valid 2. toString - returns a string in either of the two formats shown preiouvlsy based on if it has an area code or not. 3. Create a file with several telephone numbers varying between the 2 formats 4. Write a program that reads the file displays the data on the screen and creates an array whose base type is telephone number 5. Allow the user to add or delete 1 number 6. Write the modieifed data back into the text file replacing the original contents 7. Then read/display the file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions