Question

In: Computer Science

Using C++ write a code that mimics a 911 call center where emergency calls are taken...

Using C++ write a code that mimics a 911 call center where emergency calls are taken and routed to the appropriate emergency department. The code will need a class (or classes) that will hold information regarding an emergency. Calls are taken and the operator will use your program to assign values to your class objects to facilitate proper actions. Information recorded includes the address of the emergency, the name of the first responding fireman, officer, or other emergency personnel, an level of urgency, and other values related to such an application.

Write a description of what your class(es) could look like to get this information. Feel free to include actual class code, diagrams, or other tools to enhance your ideas.

Solutions

Expert Solution

Here i had provided the code with the sample output. think you understand about it. if not please comment i will assist you. please give me a like. it helps me a lot.

#include<iostream>
#include<vector>
#include<string>
using namespace std;

class Nine11Call
{
public:
string address; //the street address of the emergency
string respondent; //the name of the first responding officer or emergency personnel
int urgencyLevel; //The higher the level, the more urgent, assume always 0 - 20
bool needAmbulance;

/*
Note that an address must always be provided.
For constructors that exclude other attributes, use the fllowing values, UNLESS OTHERWISE stated.
respondent= "John Blue"
urgencyLevel = 5
needAmbulance = false
*/

Nine11Call(string addr); //Only address is provided, use defaults for other attributes
Nine11Call(string addr, bool ambulance); //Address and needAmbulance is provided, use defaults for other attributes EXCEPT
// if ambulance is needed, urgency is set to 15. So if no ambulance needed, urgencyLevel = 5, otherwise 17
Nine11Call(string addr, int howUrgent, bool ambulance); //use the default value for respondent
Nine11Call(string addr, string respondent, int howUrgent ); //needAmbulance set to false
Nine11Call(string addr, string respondent, int howUrgent, bool ambulance ); // All attributes are provided
}
;

//Implement the constructor(s) and methods here
Nine11Call::Nine11Call(string addr) //Only address is provided, use defaults for other attributes
{
address=addr;
respondent= "John Blue";
urgencyLevel = 5;
needAmbulance = false;

}
Nine11Call::Nine11Call(string addr, bool ambulance) //Address and needAmbulance is provided, use defaults for other attributes EXCEPT
{
address=addr;
respondent= "John Blue";
urgencyLevel = 5;
needAmbulance = ambulance;
}

// if ambulance is needed, urgency is set to 15. So if no ambulance needed, urgencyLevel = 5, otherwise 17
Nine11Call::Nine11Call(string addr, int howUrgent, bool ambulance) //use the default value for respondent
{
address=addr;
respondent= "John Blue";
urgencyLevel = howUrgent;
needAmbulance = ambulance;

}

Nine11Call::Nine11Call(string addr, string respondent, int howUrgent ) //needAmbulance set to false
{
address=addr;
respondent= respondent;
urgencyLevel = howUrgent;
needAmbulance = false;
}

Nine11Call::Nine11Call(string addr, string respondent, int howUrgent, bool ambulance ) // All attributes are provided
{
address=addr;
respondent= respondent;
urgencyLevel = howUrgent;
needAmbulance = ambulance;
  
}

//Implement the notify911() function here

void notify911(const Nine11Call &call){
  
   if(0<=call.urgencyLevel && call.urgencyLevel<-10){
       cout<<call.respondent<<" is responding to "<<call.address<<". An ambulance ";
       if(call.needAmbulance)cout<<" is needed.";
       else cout<<" is not needed.\n";
   }else if(11<=call.urgencyLevel && call.urgencyLevel<=15){
       cout<<call.respondent<<" is responding to "<<call.address<<" on a urgent call. An ambulance ";
       if(call.needAmbulance)cout<<" is needed.";
       else cout<<" is not needed.\n";
   }else{
       cout<<"Extremely urgent! Emergency at "<<call.address<<". Notify the Mayor!"<<endl;
   }
}

int main()
{

//The following instantiations MUST work and assign the attributes properly.
//If they do not, you've done something wrong.

Nine11Call cat("123 Maple Grove", "C. Simon", 0, false );
Nine11Call whiteCollar("8 Wall Street" );

//Do not change this array   
Nine11Call calls[6]={ Nine11Call("200 Campus Way", "Ofc. Mary Kelly", 4),
Nine11Call("1782 20th Street", 19, true),
Nine11Call("302 29th Ave", 15, false),
Nine11Call("4 Box Way", 2, true),
Nine11Call("822 Jackson Street", true),
Nine11Call("1602 PA Ave") };

//Iterate the calls array and call notify911() for each instance
for (int i=0 ;i<6;i++){
   notify911(calls[i]);
}

return 0;

}

====================================================================


Related Solutions

Does this "policy of noninterference" (other than to call 911) in a medical emergency extend to...
Does this "policy of noninterference" (other than to call 911) in a medical emergency extend to other kinds of emergencies? The woman collapsed in the dining hall, so it is not inconceivable that she could have slipped with her knife and cut an artery? Would the nurse simply watch her exsanguinate while 911 is on its way? If she slipped and fell and hit her head, would she be ignored until the emergency squad arrived? Please answer both questions!
Does this "policy of noninterference" (other than to call 911) in a medical emergency extend to...
Does this "policy of noninterference" (other than to call 911) in a medical emergency extend to other kinds of emergencies? The woman collapsed in the dining hall, so it is not inconceivable that she could have slipped with her knife and cut an artery?
Should we call Ghostbusters or 911 (the emergency number), if the flow of money becomes sluggish...
Should we call Ghostbusters or 911 (the emergency number), if the flow of money becomes sluggish within our macroeconomy? In this activity, you will explore the concepts of monetary policy, monetary policy tools, and expansionary and contractionary monetary policy. Locate a recent article (published within the last year) that discusses the objectives of the Federal Reserve Banking System, monetary policy tools and how they work, and whether the Federal Reserve Banking System is using expansionary or contractionary monetary policy. You...
At a call center, calls come in at an average rate of four calls per minute....
At a call center, calls come in at an average rate of four calls per minute. Assume that the time elapsed from one call to the next has the exponential distribution, and that the times between calls are independent. a. Find the average time between two successive calls. b. Find the probability that after a call is received, the next call occurs in less than ten seconds. c. Find the probability that less than five calls occur within a minute....
Write C++ code that prompts the user for a username and password (strings), and it calls...
Write C++ code that prompts the user for a username and password (strings), and it calls the login() function with the username and password as arguments. You may assume that username and password have been declared elsewhere. Your code should print error messages if login() generates an exception: LoginException: "Username not found or password incorrect" ServerException: "The login server is busy and you cannot log in" AccessException: "Your account is forbidden from logging into this server" Any other exception: "Unknown...
Write C++ code that prompts the user for a username and password (strings), and it calls...
Write C++ code that prompts the user for a username and password (strings), and it calls the login() function with the username and password as arguments. You may assume that username and password have been declared elsewhere. Use virtual functions, pure virtual functions, templates, and exceptions wherever possible. Please explain the code. Your code should print error messages if login() generates an exception: LoginException: "Username not found or password incorrect" ServerException: "The login server is busy and you cannot log...
Using c# programming language Write a program that mimics a lottery game. Have the user enter...
Using c# programming language Write a program that mimics a lottery game. Have the user enter 3 distinct numbers between 1 and 10 and match them with 3 distinct, randomly generated numbers between 1 and 10. If all the numbers match, then the user will earn $10, if 2 matches are recorded then the user will win $3, else the user will lose $5. Keep tab of the user earnings for, let say 5 rounds. The user will start with...
A call center randomly selects and records customer calls. Call handling times in minutes for 20...
A call center randomly selects and records customer calls. Call handling times in minutes for 20 calls are as follows: 6, 26, 8, 2, 6, 3, 10, 14, 4, 5, 3, 17, 9, 8, 9, 5, 3, 28, 21, and 4. Please calculate the 10th quartile, 90th quartile, median, Q1, Q3, sample mean, and sample standard deviation of call handling times.
A emergency center ensures that the average response time for the calls received is less than...
A emergency center ensures that the average response time for the calls received is less than 75 seconds. To corroborate this statement, an external agency collects a sample of 90 calls. For this sample, the average response time was 70 seconds with a standard deviation of 15 seconds. Does the collected information match the claim of the center? Show your work. If needed use a level of significance = 0:05
The following measurements were recorded for the duration, in seconds, of phone calls in a call-center...
The following measurements were recorded for the duration, in seconds, of phone calls in a call-center of a major corporation: 30        32        27        20 32        30        26        30 33 29 1. the mode of the dataset is: 26 s                  b)   27 s           c)   30 s           d)   32 s           e)    33 s The median of the dataset is: 30.15 s             b)   28.9 s        c)   30 s           d)   28.9 s2       e)   30 s2 The mean of the duration of the phone call...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT