: dengue and malaria. Write a complete C++ program to accomplish the following tasks: Task 1: Declare parallel arrays in the main f

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

USE C++ 

The  Malaysian Ministry of Health published data on the number of deaths by disease type. There are two types of diseases: dengue and malaria. Write a complete C++ program to accomplish the following tasks: Task 1: Declare parallel arrays in the main function to store the following types of information: a) The year. b) The mumber of deaths caused by each disease type (dengue and malaria). Task 2: Write a function named "readInput". a) This is a non-retuming function. b) It receives parallel arrays defined in Task 1. c) The function should assign the required values to each element of the parallel arrays by reading the data from the text file named "input.txt". The file includes the year as well as the mumber of deaths caused by dengue and malaria. Figure lis the content of the "input. txt" file. Please ensure that the program only contimues reading the file if it is successfully opened; otherwise, print the error message and exit the program.

Figure 1:  2007 82 18 2008 112 30 2009 88 26 2010 134 33 2011 36 18 2012 35 16 2013 92 14 2014 215 9 2015 336 8 2016 237 2 

 
Task 3: Write a fnction named "calculateAverage".
a) It receives one parameter that is an array defined in Task 1.
b) It calculates and retums the average number of deaths caused by the type of
disease.
Task 4: Write a function named "displayAnalysis".
a) This is a non-retuming function.
b) It takes as input parameters the parallel arays defined in Task 1.
c) Determine the lowest and highest total number of deaths caused by dengue and
malaria from 2007 to 2016.
d) The function should display the lowest and highest total number of deaths
determined in (c), as well as the year for the lowest and highest total number
of deaths.
e) Figure 2 shows an example of the output for (d) that will be displayed on the
screen based on the data given in the input file (see Figure 1).
Transcribed Image Text:Task 3: Write a fnction named "calculateAverage". a) It receives one parameter that is an array defined in Task 1. b) It calculates and retums the average number of deaths caused by the type of disease. Task 4: Write a function named "displayAnalysis". a) This is a non-retuming function. b) It takes as input parameters the parallel arays defined in Task 1. c) Determine the lowest and highest total number of deaths caused by dengue and malaria from 2007 to 2016. d) The function should display the lowest and highest total number of deaths determined in (c), as well as the year for the lowest and highest total number of deaths. e) Figure 2 shows an example of the output for (d) that will be displayed on the screen based on the data given in the input file (see Figure 1).
Expert Solution
steps

Step by step

Solved in 2 steps with 4 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