4. The Covid-19 Pandemic - a pandemic caused by the Coronavirus started in 2019 on our earth, Earth-111. The virus is very well known for its mutations and ability to spread. After the felling of TVA- Time Variance Authority, Covid was successful to spread throughout the multiverse to infect more hosts. Recently, you were informed about its existence in the universe of Hobbits - which started from the Shire city. To turn the entire Hobbits universe into a pandemic, it just needed to infect one significant individual and found Frodo Baggins - nephew of Bilbo Baggins. Because the virus can be transmitted from just one person to everyone else while a meetup - for example: during greeting each other, the virus has been spread to other parts of the Hobbits universe very quickly. The wizards of Hobbits himself have been infected and Thorin Oakenshield - the king of Dwarves - is looking for help from external universes. Since Earth-111 is the first to develop vaccines that have been proved to slow down the spread and minimize the effects significantly, Oakenshield is planning to import vaccines from our earth. Also considering the rate of spreading of the virus, Oakenshield has asked you to build a computer-based system to keep track of the infected individuals and their vaccine status as there might be a lack of human resources to do this task. Now, since you are learning Object Oriented Programming in Python, to test if you are eligible for the role, you are given the following driver code, and the class diagram to design the Covid, Vaccine, and Person class in Python so that the following expected output is generated. Covid +infect(): None Vaccine + brand: str + mechanism: str + doses: int + dose_gap: int + side effects: str + efficacy: float _init(): None str_0: str _call_0: None Person -name: str -infected: bool - vaccinated: bool - doses: [date_str] - vaccine: Vaccine init(): None str_0: str + accept_vaccine(): None + greet(): None Although the calendar of the Hobbits universe is similar to that of ours, there are slight changes. Unlike our months, every month (of 12) in the Hobbits universe has 31 days if it's an odd month otherwise 30 days so, they have a total of 366 days in every year - yes, there are no leaps or non-leap years. However, you do not have to worry about this as a global (lambda) function to convert a date (string) to days (integer) has been provided to you to use in classes to convert any date to a number of days.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

the question is in the first image and the driver code along with the output is on the other image. it would be helpful if the code is in easier term and no high level techniques and funtions are not used for solution

4. The Covid-19 Pandemic a pandemic caused by the Coronavirus- started in 2019 on our earth,
Earth-111. The virus is very well known for its mutations and ability to spread. After the felling of TVA -
Time Variance Authority, Covid was successful to spread throughout the multiverse to infect more
hosts.
Recently, you were informed about its existence in the universe of Hobbits which started from the
Shire city. To turn the entire Hobbits universe into a pandemic, it just needed to infect one significant
individual and found Frodo Baggins - nephew of Bilbo Baggins. Because the virus can be transmitted
from just one person to everyone else while a meetup - for example: during greeting each other, the
virus has been spread to other parts of the Hobbits universe very quickly.
The wizards of Hobbits himself have been infected and Thorin Oakenshield - the king of Dwarves - is
looking for help from external universes. Since Earth-111 is the first to develop vaccines that have been
proved to slow down the spread and minimize the effects significantly, Oakenshield is planning to
import vaccines from our earth. Also considering the rate of spreading of the virus, Oakenshield has
asked you to build a computer-based system to keep track of the infected individuals and their vaccine
status as there might be a lack of human resources to do this task.
Now, since you are learning Object Oriented Programming in Python, to test if you are eligible for the
role, you are given the following driver code, and the class diagram to design the Covid, Vaccine, and
Person class in Python so that the following expected output is generated.
Covid
+ infect(): None
Vaccine
+ brand: str
+ mechanism: str
+ doses: int
+ dose_gap: int
+ side effects: str
efficacy: float
_init__(): None
_str__(): str
_call__(): None
Person
- name: str
-infected: bool
- vaccinated: bool
- doses: [date_str]
- vaccine: Vaccine
_init__(): None
_str__(): str
+ accept_vaccine(): None
greet(): None
Although the calendar of the Hobbits universe is similar to that of ours, there are slight changes. Unlike
our months, every month (of 12) in the Hobbits universe has 31 days if it's an odd month otherwise 30
days so, they have a total of 366 days in every year - yes, there are no leaps or non-leap years.
However, you do not have to worry about this as a global (lambda) function to convert a date (string) to
days (integer) has been provided to you to use in classes to convert any date to a number of days.
Transcribed Image Text:4. The Covid-19 Pandemic a pandemic caused by the Coronavirus- started in 2019 on our earth, Earth-111. The virus is very well known for its mutations and ability to spread. After the felling of TVA - Time Variance Authority, Covid was successful to spread throughout the multiverse to infect more hosts. Recently, you were informed about its existence in the universe of Hobbits which started from the Shire city. To turn the entire Hobbits universe into a pandemic, it just needed to infect one significant individual and found Frodo Baggins - nephew of Bilbo Baggins. Because the virus can be transmitted from just one person to everyone else while a meetup - for example: during greeting each other, the virus has been spread to other parts of the Hobbits universe very quickly. The wizards of Hobbits himself have been infected and Thorin Oakenshield - the king of Dwarves - is looking for help from external universes. Since Earth-111 is the first to develop vaccines that have been proved to slow down the spread and minimize the effects significantly, Oakenshield is planning to import vaccines from our earth. Also considering the rate of spreading of the virus, Oakenshield has asked you to build a computer-based system to keep track of the infected individuals and their vaccine status as there might be a lack of human resources to do this task. Now, since you are learning Object Oriented Programming in Python, to test if you are eligible for the role, you are given the following driver code, and the class diagram to design the Covid, Vaccine, and Person class in Python so that the following expected output is generated. Covid + infect(): None Vaccine + brand: str + mechanism: str + doses: int + dose_gap: int + side effects: str efficacy: float _init__(): None _str__(): str _call__(): None Person - name: str -infected: bool - vaccinated: bool - doses: [date_str] - vaccine: Vaccine _init__(): None _str__(): str + accept_vaccine(): None greet(): None Although the calendar of the Hobbits universe is similar to that of ours, there are slight changes. Unlike our months, every month (of 12) in the Hobbits universe has 31 days if it's an odd month otherwise 30 days so, they have a total of 366 days in every year - yes, there are no leaps or non-leap years. However, you do not have to worry about this as a global (lambda) function to convert a date (string) to days (integer) has been provided to you to use in classes to convert any date to a number of days.
Driver Code:
days = lambda d: sum(
[
1
(
int (x) +
(30 int (y)+ int (y) // 2) +
366. (2000+ int ( [-2:)))
) for x, y, z in [d.split("/")]
pfizer = Vaccine ("Pfizer", "mRNA", 2, 21, "Allergies & Anaphylaxis",
0.95)
moderna = Vaccine ("Moderna", "mRNA", 2, 28, "Facial Paralysis", 0.94)
astra_zeneca = Vaccine ("Astra-Zeneca Oxford", "Adenovirus Viral vector",
2, 12, "Blood-clots, pulmonary embolism, etc",
0.7)
frodo = Person ("Frodo")
bilbo= Person ("Bilbo").
gandalf = Person ("Gandalf")
gollum = Person ("Gollum")
pfizer (frodo, "5/8/2022")
Covid. infect (frodo)
pfizer (frodo, "5/8/2022")
pfizer (frodo, "10/8/2022")
"26/8/2022")
pfizer (frodo,
pfizer (frodo, "26/8/2022")
bilbo.infected = True
print("Bilbo infected:", bilbo.infected)
frodo greet (bilbo)
print("Bilbo infected:", bilbo.infected)
print ("Gandalf infected:", gandalf.infected)
gandalf.greet (frodo, gollum)
print (gandalf.infected, gollum. infected, frodo.infected)
moderna (gollum, "27/8/22")
pfizer (gollum, "20/9/22")
moderna (gollum, "20/9/22")
moderna (gollum, "29/9/22")
print (pfizer)
Output:
Frodo is not infected.
Frodo is vaccinated with 1 Pfizer dose (s).
Dear Frodo, please come back after 16 days.
Frodo is vaccinated with 2 Pfizer dose (s).
Dear Frodo, your 2 doses for Pfizer has been completed.
Virus key mismatched
Bilbo infected: False
Bilbo infected: True
Gandalf infected: False
True True True
Gollum is vaccinated with 1 Moderna dose (s).
Gollum is vaccinated with Moderna hence, cannot take Pfizer vaccine.
Dear Gollum, please come back after 5 days.
Gollum is vaccinated with 2 Moderna dose (s).
Brand: Pfizer
Mechanism: mRNA
Doses: 2
Dose gap: 21
Side effects: Allergies & Anaphylaxis
Efficacy: 95%
Transcribed Image Text:Driver Code: days = lambda d: sum( [ 1 ( int (x) + (30 int (y)+ int (y) // 2) + 366. (2000+ int ( [-2:))) ) for x, y, z in [d.split("/")] pfizer = Vaccine ("Pfizer", "mRNA", 2, 21, "Allergies & Anaphylaxis", 0.95) moderna = Vaccine ("Moderna", "mRNA", 2, 28, "Facial Paralysis", 0.94) astra_zeneca = Vaccine ("Astra-Zeneca Oxford", "Adenovirus Viral vector", 2, 12, "Blood-clots, pulmonary embolism, etc", 0.7) frodo = Person ("Frodo") bilbo= Person ("Bilbo"). gandalf = Person ("Gandalf") gollum = Person ("Gollum") pfizer (frodo, "5/8/2022") Covid. infect (frodo) pfizer (frodo, "5/8/2022") pfizer (frodo, "10/8/2022") "26/8/2022") pfizer (frodo, pfizer (frodo, "26/8/2022") bilbo.infected = True print("Bilbo infected:", bilbo.infected) frodo greet (bilbo) print("Bilbo infected:", bilbo.infected) print ("Gandalf infected:", gandalf.infected) gandalf.greet (frodo, gollum) print (gandalf.infected, gollum. infected, frodo.infected) moderna (gollum, "27/8/22") pfizer (gollum, "20/9/22") moderna (gollum, "20/9/22") moderna (gollum, "29/9/22") print (pfizer) Output: Frodo is not infected. Frodo is vaccinated with 1 Pfizer dose (s). Dear Frodo, please come back after 16 days. Frodo is vaccinated with 2 Pfizer dose (s). Dear Frodo, your 2 doses for Pfizer has been completed. Virus key mismatched Bilbo infected: False Bilbo infected: True Gandalf infected: False True True True Gollum is vaccinated with 1 Moderna dose (s). Gollum is vaccinated with Moderna hence, cannot take Pfizer vaccine. Dear Gollum, please come back after 5 days. Gollum is vaccinated with 2 Moderna dose (s). Brand: Pfizer Mechanism: mRNA Doses: 2 Dose gap: 21 Side effects: Allergies & Anaphylaxis Efficacy: 95%
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education