Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete C++ program that helps the Ministry of Health (MOH) to determine the status of a zone by calculating the number of active

Write a complete C++ program that helps the Ministry of Health (MOH) to determine the status of a zone by calculating the number of active cases for COVID 19. The program should perform the following tasks:

Task 1: a)Write a function named dispStatus.This is a non-returning function.

b) It takes the number of active cases as an input parameter.

c)The function should display the status of a zone based on the conditions in Table 1.

Table 1

Number of active cases Status of zone
Above 40 Red
21 until 40 Orange
1 until 20 Yellow
No case Green

Task 2: Write a function named getInput.

a) This is a non-returning function.

b) It takes the number of total cases, new cases, total death, and total recovered as input parameters.

c) The function should ask the user to enter the number of total cases, new cases, total death, and total recovered.

d) It sends all the values entered by the user in (c) back to the calling module through the use of reference parameters.

Task 3: Write a function named dispOutput.

a) This is a non-returning function.

b) It takes the number of active cases as an input parameter.

c) The function should display the number of active cases and zone status by calling the dispStatus function.

Task 4: Write a function named calcAverage.

a) It takes the number of states and total active cases as input parameters.

b) The function should calculate the average number of active cases per state.

c) It should return the average value calculated in (b).

Task 5: Write a main function to perform the following tasks:

a) You need to use an appropriate LOOP to perform the process in this function. The loop will be repeated when the user press ENTER.

b) You are NOT ALLOWED to use arrays except an array of characters.

c) The function should ask the user to enter a state name.

d) The function may need to call the functions that are defined in Task 2, Task 3, and Task 4.

e) The function should calculate the number of active cases for Covid 19 using the following formula: Number of active cases = Total cases + New cases Total Death Total Recovered

f) The function should determine the state with the highest number of active cases and calculate the number of states, and the total number of active cases for all states. Note: You are NOT ALLOWED to use any predefined function(s) to determine the highest number of active cases.

g) The program should produce the output as in the sample execution given below. Note: The values in bold are input by the user.

Task 6: List all function prototypes. (4 marks) Task 7: You must ensure your program fulfill the following criteria:

a) The program is able to run.

b) The program uses an appropriate structure for the program (e.g. all required header files are included, the program is properly written, proper indentation, etc.)

SAMPLE PROGRAM EXECUTION

State name : Negeri Sembilan

Total cases : 7103

New cases : 57

Total death : 11

Total recovered: 6274

Active cases : 875 Status : Red zone Press to continue...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

What would you do?

Answered: 1 week ago