EE 31331 Programming Methodology and Software Engineering Assignment 1 Objective This programming exercise intends for the student to warm up their programming skill in C programming. Due Date March 17, 01 Media floppy disk contains the executable files and the source files with the filenames p1.exe, p1.c, p2.exe, and p2.c. Problem 1. Design a program to separate a number into three parts: a sign (+, -, or blank), an integer part of the number, and a fractional part of the number. Program Structure #include <stdio> #include <math.h> int main() { double value ; char sn; int whl; double fr; /*input /*output /*output /*output - number to analysis sign of value integer part fractional part */ */ */ */ get data from standard i/o; separate data calling separate function; display result; } /* function separates a number into an integer part of the number, and a Output parameters signp, wholep, and cells where results are to be stored three parts: a sign (+, -, or blank), fractional part of the number. fracp must contain addresses of memory */ void separate(double num, char *signp, int *wholep, double *fracp) { …… } Problem 2. Design a program to compute the mean and standard deviation of an array of data and display the difference between each value and the mean. Output format The mean is 2.01 The standard deviation is 21.75 Table of differences between data value and mean Index Data Difference 0 16.01 14.01 . . n x Mean = 1 n , Standard Derivation = n 1 x 1 n 2 1 Program Structure #include <stdio> #include <math.h> int main() { double x[100], /*data list */ mean, /*mean of data */ st_dev, /*standard deviation */ sum, /*sum of data */ sum_sqr; /*sum square of date */ int i, /*index */ max_term; /*total number of data */ get data from standard i/o; function computes sum, sum square, compute mean and standard deviation; display results; }