Anne Dawson: CSCI101A_LAB1_SP05.htm   

 

Last updated: Thursday 13th January 2005, 7:24 PT

 

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 may work in teams of 2, or alone.  This lab is due at the end of the lab session.

 

 

 

CSCI101A

 

Introduction to Computer Programming using C++

Spring 2005

Lab Assignment 1

Specification: Calculation of Body Mass Index (BMI)

Step 1

 

Go to the course web page:

 

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

 

Click on the link entitled "Using Borland C++ version 5.02"

Read and follow the instructions in the document.

 

Step 2

 

Go to the course web page:

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

Click on the link entitled "C++ Labs"

Read and follow the instructions in the document.

 

Step 3

 

Study this web page:

http://www.cdc.gov/nccdphp/dnpa/bmi/bmi-adult-formula.htm

 

Step 4

 

Implement a C++ program (filename: bmi.cpp) to calculate the BMI.

Use the Borland IDE to edit and run your program.

 

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

 

 

//  Programmer 1:  write your name here

//  Programmer 2:  write your partner's name here (if any)

//  Course code:   write your course code here, e.g. CSCI101A

//  Date:          write today's date here

//  File name:     bmi.cpp

//  Problem:       write the programming problem here

//                 (or the text book page and exercise number)

//  Reference:http://www.cdc.gov/nccdphp/dnpa/bmi/bmi-adult-formula.htm

 

Please note: any lines in a C++ program that start with the // symbols are known as comments. Comments are ignored when the program runs, but are useful when we read a program, because they supply information about the program.  They are always used at the top of a program to supply information about the purpose of a program, its file name, the programmer etc, as shown above. They are also used in the body of a program to explain parts of the program which may be hard to understand. Example programs in this course will demonstrate the correct use of comments. You are expected to supply the above set of comments (updated appropriately) for all of your lab and homework programming assignments.

 

 

 

Note: The input numbers for your program must be a real numbers (include a fractional part), so the data type for this variable will be double, not int (integer).

 

Hint: include these lines in your code:

 

double height, weight;

 

The line above declares two variables which can hold data of type double i.e. a number which includes a fractional part e.g. 1.4 or 25.241 etc.

 

 

Step 5

 

Test your program by running the same test data though the calculator on this web page:

http://www.cdc.gov/nccdphp/dnpa/bmi/calc-bmi.htm

 

 

Step 6

 

At the end of the class, save just your program file (bmi.cpp) to your folder on the network in:

 

CSCI101A\Week02\Lab01

 

The Lab01 folder will be closed at 12:05pm precisely.

Late submissions are NOT accepted.

 

To save your bmi.cpp file from the local C:\temp drive to your folder in CSCI101A\Week02\Lab01, follow the instructions in the network folder: CSCI101A\Saving

 

Please note:  Your program source code file should be named bmi.cpp and should contain appropriate comments (the file name, your name, your team partner's name if you're working in a team, the date, the program's completion status).  If you are working in a team, both partners should save the file to their own folder. Make sure that you indent (space out) the code as recommended in the text - see example programs in the textbook for examples.

 

For more hints, see: CSCI101A\C++ Program Development

 

Your instructor is always available to answer your questions.

 

There will be a ten minute break approximately half way through the lab session.

 

 

 

Program points will be based on the following marking scheme:

 

Marking Scheme

Category

Points

Description

Comments

20

The program should be commented as specified in this document.

Output

20

Screen prompts and results should be user-friendly.

Correctness

20

The program should do what is required.

Style

20

The source code should use meaningful variable names.

Test

20

Comments in the code explain how the code was tested.

 

 

Assignment Presentations :  In the next class, a random selection of lab assignment programs will be presented to the CSCI101A group.