Lab7 - COSC1415/COSC1436 Chapter 7 Lab Assignment Page 1 of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COSC1415/COSC1436 Chapter 7 – Lab Assignment Page 1 of 1 Name Chintu Patel 8001 COSC1415/COSC1436 Lab - Chapter 7 Objectives: At the end of this lab you should be able to: 1. rewrite a value-returning function as a void function 2. write void functions 3. properly use value and reference parameters 4. determine if parameters are in , out , or inout 5. write preconditions and postconditions for functions. Lab 7A: From the C++ compiler create a new project (called Canvas ) and Add Existing Item ( Canvas.cpp copied from eCampus to your storage device). a. The program has no functions. Modify the program so that it uses only void functions. You need: 1. one function to get the data from the user 2. three functions for the calculations (wood, canvas, total) 3. one function to print the output. b. Write each function parameter on a line by itself and indicate with a comment if the parameter is /*in*/ or /*out*/ c. Write preconditions and postconditions for each function d. Save, compile and run the program with the following sets of data: 1. length of 5, width of 4, cost of wood 0.25, cost of canvas 0.12 2. length of 10, width of 12, cost of wood 0.30, cost of canvas 0.09 Don’t forget to put the < your name> statement in your program. Print a copy of the program and its output. Lab 7B: From the C++ compiler create a new project (called Average ) and Add Existing Item ( Average.cpp copied from eCampus to your storage device). a. Read the program documentation and look at the function calls. Write the function definition (heading and body) for each function. b. Declare each function parameter on a line by itself and indicate if the parameter is /*in*/, /*out*/, or /*inout*/. (Remember that files are always passed as reference.) c. Write the function prototypes. d. Save, run and compile the program Don’t forget to put the < your name> statement in your program. Print a copy of the program and its output. When you are finished: Staple the program printouts and the assignment sheet together. Put the programs and their output in the order they were assigned Put the assignment sheet on top You should have two program printouts and two sets of output.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1 f:\Education\Cosc 1436\Lab Program\Chintu Patel\Windows\Lab7\Average\Average.cpp // Chintu Patel // // Program Average calculates the average of five test scores where the // lowest score is dropped for each student . The program also calculates // a class average . // Lab 7 Average Source Code # include < iostream > # include < conio . h > # include < fstream > # include < iomanip > # include < string > using namespace std ; // void function prototypes go here void Initialize ( int double ) ; void GetData ( ifstream string int int int int int ) ; void FindLowest ( int , int , int , int , int , int ) ; void CalcAverage ( int , int , int , int , int , int , double ) ; void PrintResults ( ofstream string , int , int , int , int , int , double ) ; void AccumulateClassInfo ( int
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

Lab7 - COSC1415/COSC1436 Chapter 7 Lab Assignment Page 1 of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online