Question: Need program written in java, c++ or C# Do not write program in C Telephone Switching Simulation This project simulates basic telephone functions. You will

Need program written in java, c++ or C#

Do not write program in C

Telephone Switching Simulation

This project simulates basic telephone functions. You will not be hooked up to real phones, but instead will input commands from the keyboard, and display results.

Your system will make phone calls, as well as perform three-way conferences and transfers.

The requirements are as follows:

At startup, the program will read a file containing phone numbers and names. There may be up to 20 such pairs, one per line.

The phone numbers are 5 digits long, all numbers. A phone number may begin with 0.

The names are a single name field up to 12 characters. Names are a single word (no first name, last name; lets keep it simple.) Names are all alphabetic: A-Za-z.

Commands are:

phone call phone

phone offhook

phone onhook

phone transfer phone

phone conference phone

In each command, the phone is either the phone number or the name.

Possible responses are as follows. See later requirements for the conditions for each response.

phone hears dialtone

phone hears ringback

phone hears ringing

phone hears busy

phone hears denial

phone hears silence

phone and phone are talking

phone and phone and phone are talking

Normal call:

phone1 offhook (command from user)

phone1 hears dialtone (response from computer)

phone1 call phone2 (command from user)

phone1 hears ringback (response from computer)

phone2 hears ringing (response from computer)

phone2 offhook (command from user)

phone1 and phone2 are talking (response from computer)

phone2 onhook (command from user)

phone1 hears silence (response from computer)

Conference call: After phone1 and phone2 are talking:

phone1 (or phone2) conference phone3

phone1 hears ringback

phone3 hears ringing

phone3 offhook

phone1 and phone2 and phone3 are talking

phone1 onhook

phone2 and phone3 are talking

phone1 hears silence

Transfer: After phone1 and phone2 are talking:

phone1 transfer phone3

phone1 hears ringback

phone3 hears ringing

phone3 offhook

phone1 hears silence

phone2 and phone3 are talking

If phone1 and phone2 are talking on a phone call:

phone3 offhook

phone3 hears dialtone

phone3 call phone1

phone3 hears busy

Illegal cases:

phone1 offhook

phone1 hears dialtone

phone1 call illegal_phone

phone1 hears denial

In general: if the phone is offhook, and tries to do something illegal: dial an invalid phone number, or tries to do more than a 3-way conference, the phone hears denial. See one exception below.

Another one:

phone1 call phone2 (without going offhook)

phone1 hears silence

In general: if the phone is onhook, and tries to do anything except going offhook, the phone hears silence.

Another one:

phone1 offhook

phone1 hears dialtone

phone1 offhook

(nothing happens)

In general: if the phone is offhook, and tries to go offhook again, the action is ignored. You decide whether to print a message or not.

One more important command: Status

Displays the status of the system. Lists each phones status, and if it is on a call, who it is talking to (could be more than one other phone.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!