QUESTION 1 Given the formula for converting Fahrenheit (F) to Celcius (C): C = 5/9 x (F - 32) where C is the unit of temperature in Celcius and F is the unit of temperature in Fahrenheit. Write a complete C++ program that reads in a list of data F from a text file, then calculates the values of C using the formula given. The program should use an array to store the values of F as example shown in Figure 1. 13.29 29.76 14.81 23.78 29.37 Figure 1: Example of data F in the input file The program then prints a summary output onto the screen and the detail output into a text file as shown in Figures 2 and 3. Grades 'H' mean high temperature; 'M' is medium temperature and 'L' is low temperature. Your program must define several functions at least as listed in Table 1. You are also required to apply the concept of parameter passing to these functions. LMY 2021 1 Average of the temperature: 32.3 Number of high temperature: 2 Number of medium temperature: 20 Number of low temperature: 8 Figure 2: Example of output on the screen C (Celcius) F (Farenheit) Description ========== ===== ========== 54.94 130.89 H 19.86 67.75 L 93.70 200.67 H 13.77 56.78 L : : : Figure 3: Example of content in the output file Table 1 Function Description readFile This function reads in a list of numbers from a text file and stores them into a one- dimensional array. It receives the following parameters: а. The name of the text file to be read from An array to store the list of numbers read A variable to store the number of data read b. с. computeC This function computes the values of C. It receives the following parameters: An array that contains data F а. b. An array to store the calculated values of C С. The number of data This function computes the average of a list of numbers stored in an array. This function determines either temperature (C) is high or medium or low. This function will return 'H' if C > 35 , 'M’ if C < 35 and C> 20, and 'L' if C < 20. average grade writeFile This function prints the output file as in Figure 7. It receives the following parameters: а. An array that contains data F b. An array that contains data C С. The number of data For printing summary output onto the screen, you may define another function or you may just put the code into the main function.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 3PP: (Numerical) Given a one-dimensional array of integer numbers, write and test a function that...
icon
Related questions
Question
QUESTION 1
Given the formula for converting Fahrenheit (F) to Celcius (C):
C = 5/9 x (F - 32)
where C is the unit of temperature in Celcius and F is the unit of temperature in Fahrenheit. Write a
complete C++ program that reads in a list of data F from a text file, then calculates the values of C using
the formula given. The program should use an array to store the values of F as example shown in Figure
1.
13.29
29.76
14.81
23.78
29.37
Figure 1: Example of data F in the input file
The program then prints a summary output onto the screen and the detail output into a text
file as shown in Figures 2 and 3. Grades 'H' mean high temperature; 'M' is medium temperature and
'L' is low temperature.
Your program must define several functions at least as listed in Table 1. You are also required to apply
the concept of parameter passing to these functions.
LMY 2021
1
Average of the temperature: 32.3
Number of high temperature: 2
Number of medium temperature: 20
Number of low temperature: 8
Figure 2: Example of output on the screen
C (Celcius)
F (Farenheit)
Description
==== ==== =
=====
==========
54.94
130.89
H
19.86
67.75
L
93.70
200.67
13.77
56.78
:
:
:
Figure 3: Example of content in the output file
Table 1
Function
Description
readFile
This function reads in a list of numbers from a text file and stores them into a one-
dimensional array. It receives the following parameters:
а.
The name of the text file to be read from
An array to store the list of numbers read
A variable to store the number of data read
b.
C.
computeC
This function computes the values of C. It receives the following parameters:
а.
An array that contains data F
b.
An array to store the calculated values of C
С.
The number of data
average
This function computes the average of a list of numbers stored in an array.
grade
This function determines either temperature (C) is high or medium or low. This
function will return 'H’ if C > 35 , 'M’ if C < 35 and C > 20, and 'L’ if C < 20.
This function prints the output file as in Figure 7. It receives the following
writeFile
parameters:
а.
An array that contains data F
b.
An array that contains data C
c.
The number of data
For printing summary output onto the screen, you may define another function or you may just put the
code into the main function.
Transcribed Image Text:QUESTION 1 Given the formula for converting Fahrenheit (F) to Celcius (C): C = 5/9 x (F - 32) where C is the unit of temperature in Celcius and F is the unit of temperature in Fahrenheit. Write a complete C++ program that reads in a list of data F from a text file, then calculates the values of C using the formula given. The program should use an array to store the values of F as example shown in Figure 1. 13.29 29.76 14.81 23.78 29.37 Figure 1: Example of data F in the input file The program then prints a summary output onto the screen and the detail output into a text file as shown in Figures 2 and 3. Grades 'H' mean high temperature; 'M' is medium temperature and 'L' is low temperature. Your program must define several functions at least as listed in Table 1. You are also required to apply the concept of parameter passing to these functions. LMY 2021 1 Average of the temperature: 32.3 Number of high temperature: 2 Number of medium temperature: 20 Number of low temperature: 8 Figure 2: Example of output on the screen C (Celcius) F (Farenheit) Description ==== ==== = ===== ========== 54.94 130.89 H 19.86 67.75 L 93.70 200.67 13.77 56.78 : : : Figure 3: Example of content in the output file Table 1 Function Description readFile This function reads in a list of numbers from a text file and stores them into a one- dimensional array. It receives the following parameters: а. The name of the text file to be read from An array to store the list of numbers read A variable to store the number of data read b. C. computeC This function computes the values of C. It receives the following parameters: а. An array that contains data F b. An array to store the calculated values of C С. The number of data average This function computes the average of a list of numbers stored in an array. grade This function determines either temperature (C) is high or medium or low. This function will return 'H’ if C > 35 , 'M’ if C < 35 and C > 20, and 'L’ if C < 20. This function prints the output file as in Figure 7. It receives the following writeFile parameters: а. An array that contains data F b. An array that contains data C c. The number of data For printing summary output onto the screen, you may define another function or you may just put the code into the main function.
Expert Solution
steps

Step by step

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