Can you write this program?

User Generated

Znexb

Programming

Description

Unformatted Attachment Preview

CSC 122 – INTRODUCTION TO PROGRAMMING PROG #5 100 POINTS Programming Exercise #5 Count and Sum of Numbers Due: April 6, 2015 Instructions: Write a program that reads all of the numbers stored in a file called “numbers.txt” that was created by your instructor and then display the following: 1. A count of the numbers read from the file. 2. A count of the even numbers read from the file. 3. A count of the odd numbers read from the file. 4. The sum of the even numbers read from the file. 5. The sum of the odd numbers read from the file. NOTE: A number is even is it can be divided by 2 and has no remainder. Explore the ideal of using the % (remainder) symbol to accomplish this. See Chapter 2, page 54 for more information. Programming Style Requirements 1. Standard Output Program Header Information CSC 122-W1 – Program #5 By The standard output program header information is to be included at the top of the program and should be the first lines displayed on the output screen. 2. Comments The program must include a main comment block (2-3 lines is sufficient) before the standard output program header information that describes the purpose of the program. There should also be comments included throughout the program to describe what is going on in the program (i.e. input and calculation). 3. Descriptive names must be used for all variables in the program. 4. The program must have at least one (1) function. 5. The program must properly label the output. See the screen capture below. Winter 2015 1 4/6/2015 CSC 122 – INTRODUCTION TO PROGRAMMING PROG #5 6. Saving the Program Save the source code for the program as Prog5.py Required Output: The program output should look identical to the screen capture above. NOTE: When testing your program, make sure the numbers.txt file is located in the same area that your source code is located. If the text file cannot be found when the program is executed, the following error message will be displayed: Winter 2015 2 4/6/2015 CSC 122 – INTRODUCTION TO PROGRAMMING PROG #5 When the program is working correctly and free of syntax errors, submit the Prog5.py file to Blackboard. (DO NOT send the program via email. Only homework submitted via Blackboard will be graded.) Grade Rubric: Points Description 5 The program is saved as Prog5.py. 5 The program displays the standard program header information. 10 A main comment block is included to describe what the program does. See #2 above. 5 Comments are included throughout the program to describe the difference processes used. See #2 above. 10 Descriptive variable names are used in the program. 10 The program contains at least one (1) function. 10 The program displays a count of the numbers read from the file. 10 The program displays a count of the even numbers read from the file. 10 The program displays a count of the odd numbers read from the file 10 The program displays the sum of the even numbers read from the file. 10 The program displays the sum of the odd numbers read from the file. 5 The program output is identical to the required output. See screen capture above. 100 Total Points Program should be submitted by Monday, April 6. Winter 2015 3 4/6/2015
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer


Anonymous
I was having a hard time with this subject, and this was a great help.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags