Anne Dawson: CSCI101A_HW2_SP05.htm   

 

Last updated: Thursday 3rd February 2005, 6:20 PT, AHD 

 

This document is subject to change without notice.

 

Please report any errors or omissions in this document:

adawson@coquitlamcollege.com

 

Special instructions:  For this assignment you must work alone.

 

 

CSCI101A

 

Introduction to Computer Programming using C++

Spring 2005

Homework 2

Specification: Calculation of Linear Regression

Step 1

 

Study this web page:

 

http://phoenix.phys.clemson.edu/tutorials/excel/regression.html

Note: you do not type in the code of your program until Step 4.

Your program should read in a set of x,y pairs from a file, calculate the equation of the best straight line through the data, and output the equation of the straight line to the screen. You should use several files of test data of various size. The user of the program should be prompted for the file name. The program should repeat at the user’s request.

Step 2

Design an algorithm (the steps to solve the problem). The following web page will help you design your algorithm and pseudocode:

http://www.coquitlamcollege.com/adawson/Pseudocode.htm

Step 3

Development the pseudocode from your algorithm. The following web page will help you design your algorithm and pseudocode:

http://www.coquitlamcollege.com/adawson/Pseudocode.htm

Step 4

Using your pseudocode as a guide, implement your program in the C++ language. Use either the Borland or Dev-C++ IDE to edit and run your program.

Your program should start with a comment block that contains the following information:

//  File:       HW2.cpp

//  Purpose:    Linear regression calculation

//  Programmer: [your name]  

//  Course:     CSCI101A

//  Date:      

//  Test data:

Step 5

Test your program by running supplying your own test data. You should test your program with at least 4 sets of test data. Show your test data and results in comments at the top of your program.

Step 6

At the start of the class on the due date, save your homework files to the appropriate folder on the network.

 

 

 

 

Program points will be based on the following marking scheme:

Marking Scheme: CSCI101A   -   Homework 2  -   Linear Regression

Student name:

Category

Points

Description

Algorithm

10

An informal description of the steps that must be taken to solve the problem.

ref: http://www.coquitlamcollege.com/adawson/Pseudocode.htm

Pseudocode

10

A formal description of the steps that must be taken to solve the problem.

http://www.coquitlamcollege.com/adawson/Pseudocode.htm

Comments

10

The program is commented appropriately.

Style

10

The source code should use meaningful variable names (identifiers), appropriate data types and control structures.

Modularity

20

Functions should be used where it makes sense to use them. All functions should have pre- and post-condition comments.

Output

10

Screen prompts and results should be user-friendly.

Correctness

10

The program should output correct results.

Completeness

10

The program should be complete.

Test

10

Comments in the code explain how the code was tested.

Assignment Presentations :  On the due date, a random selection of homework assignment programs will be presented to the CSCI101A group.