Overview of Programming Tasks - Input/output | CPSC 244, Study Guides, Projects, Research of Computer Science

Material Type: Project; Professor: Nystrom; Class: Sci Programming with Fortran; Subject: Computer Science; University: Ferris State University; Term: Spring 2009;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/07/2009

koofers-user-u4y-1
koofers-user-u4y-1 🇺🇸

5

(2)

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CPSC 244 Project 5
Spring 2009
31 March 2009
Input/Output
ASSIGNED: 31 March 2009
DUE: 7 April 2009 (by the end of class.)
VALUE: 24 points
Overview: In this project you will complete two programming tasks; both involving writing
and reading of files. (Format your output appropriately.)
Tasks:
1. (12 points) Write a program that reads in a filename and an integer value (repre-
senting the number of values that are to be written to a file). Then:
Open a new file with the given filename. If the file already exists, you should
print an error message and exit the program.
Write integer values from 1 to value into the file just opened.
Close and re-open the file filename for reading.
Read values from the file until the END-OF-FILE is encountered, keeping the re-
quired statistics so that you can calculate the mean and standard deviation of the
data in the file.
Print the resulting mean and standard deviation of the data in the file.
2. (12 points) Write a program that reads in a filename and five parameter values (rep-
resenting the slope and y-intercept of two lines, and the number of points, num_of, to
write to a file). Then:
Open a new file with the given filename. If the file already exists, you should
print an error message and exit the program.
Write num_of points for each of the two lines (whose particulars were input) into
the file just opened.
Close and re-open the file filename for reading.
Read point values from the file until the END-OF-FILE is encountered, keeping the
required statistics so that you can calculate the least squares line of the data in
the file.
Print the resulting slope and y-intercept of the least squares line.
1
pf2

Partial preview of the text

Download Overview of Programming Tasks - Input/output | CPSC 244 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CPSC 244 Project 5

Spring 2009

31 March 2009

Input/Output

ASSIGNED: 31 March 2009 DUE: 7 April 2009 (by the end of class.) VALUE: 24 points

Overview: In this project you will complete two programming tasks; both involving writing and reading of files. (Format your output appropriately.)

Tasks:

  1. (12 points) Write a program that reads in a filename and an integer value (repre- senting the number of values that are to be written to a file). Then: - Open a new file with the given filename. If the file already exists, you should print an error message and exit the program. - Write integer values from 1 to value into the file just opened. - Close and re-open the file filename for reading. - Read values from the file until the END-OF-FILE is encountered, keeping the re- quired statistics so that you can calculate the mean and standard deviation of the data in the file. - Print the resulting mean and standard deviation of the data in the file.
  2. (12 points) Write a program that reads in a filename and five parameter values (rep- resenting the slope and y-intercept of two lines, and the number of points, num_of, to write to a file). Then: - Open a new file with the given filename. If the file already exists, you should print an error message and exit the program. - Write num_of points for each of the two lines (whose particulars were input) into the file just opened. - Close and re-open the file filename for reading. - Read point values from the file until the END-OF-FILE is encountered, keeping the required statistics so that you can calculate the least squares line of the data in the file. - Print the resulting slope and y-intercept of the least squares line.

Submit the following:

  1. A stapled set of legible solutions which includes a printout of any programs. Your program should have some comments which - at minimum - includes your name, date the program was written, and the problem which is being solved.
  2. Send an email with the program source codes as attachments to [email protected] with the Subject: Chap5 P5.