Using c++ perform this activity

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Using c++ perform this activity

Procedure
Imagine that it is flu season and health department officials are planning to visit a school to ensure that all the enrolled children are administered their flu shot. However, there is a problem:
a few children have already taken their flu shots but do not remember if they have been vaccinated against the specific category of flu that the health officials plan to vaccinate all the
students against. Official records are sought out and the department is able to find a list of students that have already been administered the vaccine. A small excerpt of the list is shown
here:
First Name Last Name Flu Shot Administered?
1
3
Yes
2
2
No
2
3
Yes
Assume that all the names are positive integers and that the given list is sorted. Your task is to write a program that can look up the vaccination status of a given student in the list and
outputs to the officials whether the student needs to be vaccinated. Students need to be vaccinated in case of two conditions:
• If they are not present in the list
• If they are present in the list but have not been administered a flu shot
Since the list can have a large number of students, your program should be as fast and efficient as possible. The final output of your program should look as follows:
Time taken to search = 45 microseconds
Student (836 118) needs vaccination.
Time taken to search = 37 microseconds
Student (836 118) needs vaccination.
Time taken to search = 53 microseconds
Student (836 118) needs vaccination.
High-Level Steps:
Useful steps to follow for the implementation of a solution:
1. Represent each student as an object of the Student class, which can be defined as follows:
class Student
std::pair<int, int> name;
bool vaccinated;
}
2. Overload the required operators for the Student class so that a vector of students can be sorted using the Standard Library's std:sort() function.
3. Use a binary search to see if the student is present on the list.
4. If the student isn't present in the list, your function should return true since the student needs to be administered the vaccine.
5. Otherwise, if the student is present in the list but has not been administered the vaccine, return true.
6. Else, return false.
Transcribed Image Text:Procedure Imagine that it is flu season and health department officials are planning to visit a school to ensure that all the enrolled children are administered their flu shot. However, there is a problem: a few children have already taken their flu shots but do not remember if they have been vaccinated against the specific category of flu that the health officials plan to vaccinate all the students against. Official records are sought out and the department is able to find a list of students that have already been administered the vaccine. A small excerpt of the list is shown here: First Name Last Name Flu Shot Administered? 1 3 Yes 2 2 No 2 3 Yes Assume that all the names are positive integers and that the given list is sorted. Your task is to write a program that can look up the vaccination status of a given student in the list and outputs to the officials whether the student needs to be vaccinated. Students need to be vaccinated in case of two conditions: • If they are not present in the list • If they are present in the list but have not been administered a flu shot Since the list can have a large number of students, your program should be as fast and efficient as possible. The final output of your program should look as follows: Time taken to search = 45 microseconds Student (836 118) needs vaccination. Time taken to search = 37 microseconds Student (836 118) needs vaccination. Time taken to search = 53 microseconds Student (836 118) needs vaccination. High-Level Steps: Useful steps to follow for the implementation of a solution: 1. Represent each student as an object of the Student class, which can be defined as follows: class Student std::pair<int, int> name; bool vaccinated; } 2. Overload the required operators for the Student class so that a vector of students can be sorted using the Standard Library's std:sort() function. 3. Use a binary search to see if the student is present on the list. 4. If the student isn't present in the list, your function should return true since the student needs to be administered the vaccine. 5. Otherwise, if the student is present in the list but has not been administered the vaccine, return true. 6. Else, return false.
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY