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.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section: Chapter Questions
Problem 8PP: (Data processing) A bank’s customer records are to be stored in a file and read into a set of arrays...
icon
Related questions
Question

USE C++

From 2007 to 2016, 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.
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
Figure 1: Data set stored in the "input.txt" file
Transcribed Image Text:From 2007 to 2016, 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. 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 Figure 1: Data set stored in the "input.txt" file
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Array
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning