Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Download numbers.txt file from Canvas, in the Lab 04 folder. The numbers.txt file contains a long list of random numbers. Copy the file to your

image text in transcribed
Download numbers.txt file from Canvas, in the Lab 04 folder. The numbers.txt file contains a long list of random numbers. Copy the file to your hard drive and then write a program that opens the file, reads all the numbers from the file, and calculates the followings: A) The number of even numbers in the file. B) The number of odd numbers in the file C) The sum of even numbers in the file. D) The sum of odd numbers in the file. E) The average of all even numbers in the file. F) The average of all odd numbers in the file. The program should print all the above values (A-F) in a file (inData.txt) as shown below. Number of even numbers: 99 Number of odd numbers: 101 Sum of even numbers: 49930.00 Sum of odd numbers: 55597.00 Average of even numbers: 504.34 Average of odd numbers: 550.47 Check if the input file exists and round the even and odd averages to two decimal places. Download numbers.txt file from Canvas, in the Lab 04 folder. The numbers.txt file contains a long list of random numbers. Copy the file to your hard drive and then write a program that opens the file, reads all the numbers from the file, and calculates the followings: A) The number of even numbers in the file. B) The number of odd numbers in the file C) The sum of even numbers in the file. D) The sum of odd numbers in the file. E) The average of all even numbers in the file. F) The average of all odd numbers in the file. The program should print all the above values (A-F) in a file (inData.txt) as shown below. Number of even numbers: 99 Number of odd numbers: 101 Sum of even numbers: 49930.00 Sum of odd numbers: 55597.00 Average of even numbers: 504.34 Average of odd numbers: 550.47 Check if the input file exists and round the even and odd averages to two decimal places

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions