get_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter6: Sub And Function Procedures
Section: Chapter Questions
Problem 1MQ3
icon
Related questions
Question
100%

get_total_cases() takes the a 2D-list (similar to database) and an integer x from this
set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents
Age_Group and 2 represents Client_Gender (these are the fields on the header row, the
integer value represents the index of each of these fields on that row). This function computes
the total number of reported cases for each instance of x in the text file, and it stores this
information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns
the dictionary and the total number of all reported cases saved in this dictionary.

This section describes the required functions that you must add to your module. You are
encouraged to create additional helper functions where necessary. You must test these functions
using different text files inside the main() function. The final version of your module must only
contain functions and a single call to the main() function (i.e., there should not be any additional
function calls or print statements outside the main() function).
(e) get_total_cases() takes the a 2D-list (similar to database) and an integer x from this
set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents
Age_Group and 2 represents Client_Gender (these are the fields on the header row, the
integer value represents the index of each of these fields on that row). This function computes
the total number of reported cases for each instance of x in the text file, and it stores this
information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns
the dictionary and the total number of all reported cases saved in this dictionary.
(Suppose we want to know the total number of cases reported on each date, so use x = 0.)
>>> result, total_cases = get_total_cases (database, 0)
>>> display_dict(result)
2021-05-19: 8
2021-05-20: 2
2021-05-21: 1
2021-05-22: 1
>>> print(total_cases)
Transcribed Image Text:This section describes the required functions that you must add to your module. You are encouraged to create additional helper functions where necessary. You must test these functions using different text files inside the main() function. The final version of your module must only contain functions and a single call to the main() function (i.e., there should not be any additional function calls or print statements outside the main() function). (e) get_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary. (Suppose we want to know the total number of cases reported on each date, so use x = 0.) >>> result, total_cases = get_total_cases (database, 0) >>> display_dict(result) 2021-05-19: 8 2021-05-20: 2 2021-05-21: 1 2021-05-22: 1 >>> print(total_cases)
12
The sample output for x = 1 (Age_Group)
>>> result, total_cases = get_total_cases (database, 1)
>>> display_dict(result)
20: 1
30: 1
40: 2
60: 2
70: 1
<20: 5
>>> print(total_cases)
12
The sample output for x = 2 (Client_Gender)
>>> result, total_cases =
>>> display_dict(result)
get_total_cases (database, 2)
FEMALE: 4
GENDER DIVERSE: 1
MALE: 6
UNSPECIFIED: 1
>>> print (total_cases)
12
Transcribed Image Text:12 The sample output for x = 1 (Age_Group) >>> result, total_cases = get_total_cases (database, 1) >>> display_dict(result) 20: 1 30: 1 40: 2 60: 2 70: 1 <20: 5 >>> print(total_cases) 12 The sample output for x = 2 (Client_Gender) >>> result, total_cases = >>> display_dict(result) get_total_cases (database, 2) FEMALE: 4 GENDER DIVERSE: 1 MALE: 6 UNSPECIFIED: 1 >>> print (total_cases) 12
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Binary Search Algorithm
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
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L