Question

In: Computer Science

QUESTİON 2-HOMEWORK1 QUESTİON experienced and beginner officers at a police station.While preparing the guard of roster,...

QUESTİON 2-HOMEWORK1 QUESTİON
experienced and beginner officers at a police station.While preparing the guard of roster,
Two-person patrols consisting of an experienced and a beginner will be identified.Every experienced officer must keep watch with all beginner officers.
the number of officers entered on the keyboard (up to 30) and according to the registration numbers of the officers.

Write the c ++ program, which writes the registration numbers and patrol guard lists of the beginner and experienced officers, in accordance with the prototype given in the options.
NOTE:
The registration numbers of experienced officers are odd and the registration numbers of novice officers are double.
It is assumed that at least one experienced and a beginner registration number will be entered from the keyboard.
EXAMPLE:
enter the number of officers:6
Enter the registration numbers of 6 officers:
18 25 28 13 296 160

registration numbers of beginner officers:18, 28,296,160

registration numbers of experienced officers:25,13
watch list:
25-18
25-28
25-296
25-160
13-18
13-28
13-296
13-160

QUESTİON2 You see the prototype at the bottom in the order of the function.
List of registration numbers sent from the main functions and in the main function takes the number of officers entered from the keyboard as parameters
Prints the above screen output in the function.

void deneyimliAcemiAyirarakYaz(int sicil[],int memurSayisi);


HOMEWORK1 you saw the prototype at the bottom List of registration number sent from the main
in order of function,officer count,experienced and beginner worker gets the empty list.

void deneyimliAcemiAyir(int *,int memurSayisi,int *,int *);

function fills empty lists.Results must be printed in the main function.


.

Solutions

Expert Solution

//Required c++ program for first question:

#include <bits/stdc++.h>
using namespace std;


int main()
{
    int n,x;
    cout<<"Enter the number of officers: ";
    cin>>n;
    cout<<"Enter the regustration numbers of "<<n<<" officers: ";
  
    vector<int>exp,beg; //creating vectors for both type of officers
  
    for(int i=0;i<n;i++){
      
        cin>>x; //taking input reg. no.
      
        if(x%2==0){ //if even pushing in beg vector
          
            beg.push_back(x);
          
        } else { //if odd pushing in exp vector
          
            exp.push_back(x);
          
        }
    }
  
    //Printing the two lists
    cout<<"Registration numbers of beginner officers: ";
    for(int i=0;i<beg.size();i++){
        cout<<beg[i]<<" ";
    }
    cout<<endl;
  
    cout<<"Registration numbers of experienced officers: ";
    for(int i=0;i<exp.size();i++){
        cout<<exp[i]<<" ";
    }
    cout<<endl;
  
    cout<<"Watch List:"<<endl; //printing watch list
  
    for(int i=0;i<exp.size();i++){ //looping in experienced officers
      
        for(int j=0;j<beg.size();j++){ //looping in beginner officers
          
            cout<<exp[i]<<"-"<<beg[j]<<endl;
        }
    }
  
    return 0;
}

Please refer to the screenshot of the code to understand the indentation of the code

Sample Run:

Hope this helped. Please do upvote and if there are any queries please ask in comments section.


Related Solutions

2. For a sample of 900 police officers at a local police department, a researcher believes...
2. For a sample of 900 police officers at a local police department, a researcher believes there is a relationship between “number of arrests per month” and “police use of force.” Using the following data, test the null hypothesis at the .01 level of significance that police use of force does not differ by the number of arrests per month that an officer makes. In so doing, identify: (1) the research and null hypothesis, (2) the critical value needed to...
For a sample of 900 police officers at a local police department, a researcher believes there...
For a sample of 900 police officers at a local police department, a researcher believes there is a relationship between “number of arrests per month” and “police use of force.” Using the following data, test the null hypothesis at the .01 level of significance that police use of force does not differ by the number of arrests per month that an officer makes. In so doing, identify: (1) the research and null hypothesis, (2) the critical value needed to reject...
If I want to study the attitudes of police officers toward drug enforcement, the individual police...
If I want to study the attitudes of police officers toward drug enforcement, the individual police officers represent what? temporal order spurious relationship causation unit of analysis ---- QUESTION If I find that crime is prevalent in a low income neighborhood, I can assume that all individuals in this neighborhood are criminals. True False
The tidewater police department is a small rural department that consists of 22 police officers, 4...
The tidewater police department is a small rural department that consists of 22 police officers, 4 detectives, a criminal intelligence analyst and 3 secretaries. The police department has a new chief op police that has created and enacted a code of conduct and ethics policy. About half of the officers have 20 +years of experience and the other half have less than 3 years of experience. You are a rookie police officer on your first patrol. The older, experienced officer...
The Philadelphia Police Department must decide how to allocate police officers between West Philadelphia and Center...
The Philadelphia Police Department must decide how to allocate police officers between West Philadelphia and Center City. Measured in arrests per hour, the average product, total product, and marginal product in each of these two areas are given in the table below. Currently, the police department allocates 200 police officers to Center City and 300 to West Philadelphia. If police can be redeployed only in groups of 100, how, if at all, should the police department reallocate its officers to...
Problem-Solving Case: Suspensions of Lexington, Kentucky, Police Officers A police officer in Lexington, Kentucky, was troubled...
Problem-Solving Case: Suspensions of Lexington, Kentucky, Police Officers A police officer in Lexington, Kentucky, was troubled by content some other officers had posted on the MySpace.com networking Web site. These officers discussed their work, includ- ing arrests they had made. Their postings included put-downs such as slurs about gays and mentally disabled people and comments that they worked for Lexington’s “snobby peo- ple” and the “Lexington Fayette Urban Commu- nist [instead of County] Government.” Photos on these officers’ MySpace pages...
The data below shows the score on a promotion test given to police officers and the...
The data below shows the score on a promotion test given to police officers and the number of hours studied. Hours Studied Score on promotion test 0 0 1 1 2 1 3 2 4 5 6 6 12 8 16 10
2328 A. Consider the use of Deadly Force by police officers in light of all the...
2328 A. Consider the use of Deadly Force by police officers in light of all the media attention presented. Do you believe the media's portrayal of the force used by police officers is justified or unjustified? What would you do to change, if anything, the negative perception attributed to police officers by the media to the public? After you respond to the question with your opinion, in a few sentences respond to the two classmates opinion if you agree with...
20 police officers work at Kadıköy Police Station. Each officer works for 5 days per week....
20 police officers work at Kadıköy Police Station. Each officer works for 5 days per week. The crime rate fluctuates with the day of week, so the number of the police officers required each day depends on which day of the week it is: Monday, 10; Tuesday, 13; Wednesday, 14; Thursday, 16; Friday, 14; Saturday, 18; Sunday, 10. The Police Station wants to schedule police officers to maximize the number of the officers whose days off are consecutive. Formulate an...
I am in health information management. 2 police officers come to me requesting I give them...
I am in health information management. 2 police officers come to me requesting I give them a copy of the lab report that was sent to the coroner's office disclosing the blood alcohol level of the patient so they can pursue a case against them. Can I give them this information?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT