sample_C_final_test

sample_C_final_test - processing already entered results...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Swinburne University Faculty of Engineering and Industrial Sciences HES1300 Robotics & Mechatronics Project 1 Sample Laboratory Test (30%): You have 90 minutes to finish this test. After finished writing your code and comments, copy and paste your code (and comments) into the blackboard as explained by your lab demonstrator. Your work will be assessed for correctness (20%), appropriate use of comments (5%) and style (5% - appropriate use of arrays can improve the style of some programs). 1. At a company making brake pads, the thickness of every pad is measured at 3 different places along the pad. Write a C program that reads the pad thicknesses of up to 4 pads from the computer keyboard (prompt the user to enter 5 floating point numbers for every pad). When the measurement data of 10 pads are entered or if the user enters a value that is outside the thickness range of a pad (0.0 –100.0 mm), the program should stop taking inputs and continue
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: processing already entered results (do not process the pad with an outside the range measurement) (10%). 2. Then write a separate function called "myWeightedAvg" which takes the measurements of a pad as inputs and returns their weighted average (defined below) * as a floating-point variable (5%). 3. In the main program, call the "myWeightedAvg" function and print the results (in a table) on the computer screen similar to the one shown here (5%). Pad Number M1 M2 M3 Weighted Avg 1 100.o 100.0 100.0 100.0 2 50.0 10.0 20.0 56.7 4. Write appropriate comments for all the functions (including the main) in your program (5%). * The weighted average in the above company is defined as: n i n M wavg n i i =-= 1 ) ( . where n is the number of measurements taken from one pad (n=3) and M i is the measurement of the i th point on the pad....
View Full Document

This note was uploaded on 09/29/2010 for the course C++ c taught by Professor Lauren during the Three '10 term at Swinburne.

Ask a homework question - tutors are online