Can you answer those 4 questions as short as possible please. 1. What variable type did you use to store your temperatures and why? 2. What variable type did you use to store the indices into your arrays and why? 3. What variable type did you use to store the averages and why? 4. Would you prefer not to use arrays in this scenario?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
Can you answer those 4 questions as short as possible please. 1. What variable type did you use to store your temperatures and why? 2. What variable type did you use to store the indices into your arrays and why? 3. What variable type did you use to store the averages and why? 4. Would you prefer not to use arrays in this scenario?
File
Edit
e.cpp
pMonitor.c
View
1-288 2
#include <iostream>
#include <iomanip>
using namespace std;
Driver code
Bint main(
Git
Project
cout << "\nThe high temperature were: ";
for (int i = 0; i < 4; i++) {
Build
int tempHigh [10], tempLow [10], i = 0, high, Low, dayH = 1, dayL = 1;
float avgH, avgL, sumH = 0, sumL = 0, avg;
cout << "===SEP Temperature Analyzer===---\n";
while (i < 4) {
cout<<"Enter the high value for day " << i + 1 << ": ";
cin >> high;
cout << tempHigh[i]<<" ";
sumH += tempHigh [i];
out from: Debug
Test
cout << "\nThe low temperature were: ";
for (int i = 0; i < 4; i++) {
x0 44
个
Debug
Debug x64
(Global Scope)
cout<<"Enter the low value for day " << i + 1 << ": ";
cin >> low;
if ((high > Low) && (high <= 40 && high >= -40) && (Low <= 40 && Low >= -48)) {
tempHigh [i] = high;
tempLow[i] = low;
itt;
Analyze
Tools
else {
cout << "\nIncorrect values, temperature must be in the range -40 to 40, high must be greater than low.\n";
cout << endl;
Extensions Window
Local Windows Debugger
Help
main()
Search
Transcribed Image Text:File Edit e.cpp pMonitor.c View 1-288 2 #include <iostream> #include <iomanip> using namespace std; Driver code Bint main( Git Project cout << "\nThe high temperature were: "; for (int i = 0; i < 4; i++) { Build int tempHigh [10], tempLow [10], i = 0, high, Low, dayH = 1, dayL = 1; float avgH, avgL, sumH = 0, sumL = 0, avg; cout << "===SEP Temperature Analyzer===---\n"; while (i < 4) { cout<<"Enter the high value for day " << i + 1 << ": "; cin >> high; cout << tempHigh[i]<<" "; sumH += tempHigh [i]; out from: Debug Test cout << "\nThe low temperature were: "; for (int i = 0; i < 4; i++) { x0 44 个 Debug Debug x64 (Global Scope) cout<<"Enter the low value for day " << i + 1 << ": "; cin >> low; if ((high > Low) && (high <= 40 && high >= -40) && (Low <= 40 && Low >= -48)) { tempHigh [i] = high; tempLow[i] = low; itt; Analyze Tools else { cout << "\nIncorrect values, temperature must be in the range -40 to 40, high must be greater than low.\n"; cout << endl; Extensions Window Local Windows Debugger Help main() Search
e Edit View Git Project Build Debug Test Analyze
28892
Debug x64
=.cpp X
pMonitor.c
4
35
36
37
38
39
40
41
42
43
4.4
45
46
49
50
52
53
55
B
56
57
62%
cout <<tempHighli] << "";
sumH += tempHigh[i];
cout << "\nThe low temperature were: ";
for (int i = 0; i < 4; i++) {
cout << tempLow[i] << " ";
sumL += tempLow[i];
}
cout << endl;
avgH = sumH / 4;
avgL = sumL / 4;
avg= (float) (avgH + avgL) / 2;
int highest = tempHigh [0];
int Lowest = tempLow[0];
for (int i = 0; i < 4; i++) {
if (highest < tempHigh[i]) {
highest = tempHigh[i];
dayH = (1 + 1);
if (lowest > tempLow[i]) {
Lowest = tempLow[i];
dayL = (1 + 1);
cout << "The average LOW temperature was: <<setprecision (2) << avgL << endl;
cout << "The average HIGH temperature was:
<<setprecision (2) << avgH << endl;
cout << "The average temperature was: " <<setprecision (2) << avg << endl;
cout << "The highest temperature was: " << highest <<", on day <<dayH << endl;
cout << "The Lowest temperature was: << Lowest <<, on day << dayL << endl;
return 0;
x0
(Global Scope)
4 个 ↓
Output
Show output from: Debug
'tempMonitor.c.exe' (Win32): Loaded C:\Windows\System³2) mount
Tools
Extensions Window Help
Local Windows Debugger
main(
Ln:
Transcribed Image Text:e Edit View Git Project Build Debug Test Analyze 28892 Debug x64 =.cpp X pMonitor.c 4 35 36 37 38 39 40 41 42 43 4.4 45 46 49 50 52 53 55 B 56 57 62% cout <<tempHighli] << ""; sumH += tempHigh[i]; cout << "\nThe low temperature were: "; for (int i = 0; i < 4; i++) { cout << tempLow[i] << " "; sumL += tempLow[i]; } cout << endl; avgH = sumH / 4; avgL = sumL / 4; avg= (float) (avgH + avgL) / 2; int highest = tempHigh [0]; int Lowest = tempLow[0]; for (int i = 0; i < 4; i++) { if (highest < tempHigh[i]) { highest = tempHigh[i]; dayH = (1 + 1); if (lowest > tempLow[i]) { Lowest = tempLow[i]; dayL = (1 + 1); cout << "The average LOW temperature was: <<setprecision (2) << avgL << endl; cout << "The average HIGH temperature was: <<setprecision (2) << avgH << endl; cout << "The average temperature was: " <<setprecision (2) << avg << endl; cout << "The highest temperature was: " << highest <<", on day <<dayH << endl; cout << "The Lowest temperature was: << Lowest <<, on day << dayL << endl; return 0; x0 (Global Scope) 4 个 ↓ Output Show output from: Debug 'tempMonitor.c.exe' (Win32): Loaded C:\Windows\System³2) mount Tools Extensions Window Help Local Windows Debugger main( Ln:
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education