kindly write a complete program that opens the file, sheet.txt (I will type the data that is in this file) for reading. The open operation on the file must be verified and if the file did not open, the program should exit after printing an error. The file contains a single column of double numbers that must be read into an array. The file contains no more than 100 values. The file should be read until end of file. The average value should be calculated and written out to the display. The following is an example of how it should run. dj@schroeder: ./a.out Average is 446.369 ------------------------------ the following are what is in the file sheet.txt 389.86176.75519.14985.76224.22444.4547.42380.77253.5137.3729.29986.77792.85641.35165.64353.5878.7152.51868.6753.46801.94348.45204.0291.91316.13842.34105.04120.19794.87207.05348.4520292.92245.43702.96181.8312.09480.7619.19329.26508.03537.32811.03946.376.06556.51615.09590.85176.75526.21536.31467.63523.18116.15130.29734.27459.55131.3322.19321.18643.37364.61291.89349.46789.82835.27168.67673.67976.67469.65737.3148.47154.53954.45162.61766.59508.03118.17448.44746.39454.5174.73247.45493.89963.54251.49276.74313.1844.36391.88363.678.78338.35295.93677.71704.98396.93665.59219.17831.23

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

kindly write a complete program that opens the file, sheet.txt (I will type the data that is in this file) for reading. The open operation on the file must be verified and if the file did not open, the program should exit after printing an error. The file contains a single column of double numbers that must be read into an array. The file contains no more than 100 values. The file should be read until end of file. The average value should be calculated and written out to the display.

The following is an example of how it should run.

dj@schroeder: ./a.out

Average is 446.369

------------------------------

the following are what is in the file sheet.txt

389.86
176.75
519.14
985.76
224.22
444.4
547.42
380.77
253.51
37.37
29.29
986.77
792.85
641.35
165.64
353.5
878.7
152.51
868.6
753.46
801.94
348.45
204.02
91.91
316.13
842.34
105.04
120.19
794.87
207.05
348.45
202
92.92
245.43
702.96
181.8
312.09
480.76
19.19
329.26
508.03
537.32
811.03
946.37
6.06
556.51
615.09
590.85
176.75
526.21
536.31
467.63
523.18
116.15
130.29
734.27
459.55
131.3
322.19
321.18
643.37
364.61
291.89
349.46
789.82
835.27
168.67
673.67
976.67
469.65
737.3
148.47
154.53
954.45
162.61
766.59
508.03
118.17
448.44
746.39
454.5
174.73
247.45
493.89
963.54
251.49
276.74
313.1
844.36
391.88
363.6
78.78
338.35
295.93
677.71
704.98
396.93
665.59
219.17
831.23

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

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