Document Sample

Assignments Assignment 1 Write a program to calculate the current equation L 1 2 p 2 1 sin 4 g 2 Where p is the period of pendulum in seconds, g=980 cm/sec2 (acceleration), L is the pendulum length in cm, is the angle of displacement in degrees. Assignment 2 Suppose that the gas company bases its charges on consumption according to the following table: Gas Used Rate First 70 cubic meters $5.00 minimum cost Next 100 cubic meters 5 .0 ¢ per cubic meter Next 230 cubic meters 2.5 ¢ per cubic meter Above 400 cubic meters 1.5 ¢ per cubic meter Continue of assignment 2 Meter readings are four-digit numbers that represent cubic meters. Write a program in which the meter reading for the previous month and the current meter reading are entered and then the amount of the bill is calculated. The current reading may be less than the previous one; for example the previous reading may have been 9897, and the current one is 0103. Use IF statement. Assignment 3 Write a program to read a set of numbers, and calculate the mean, variance, and standard deviation of the set of numbers. The mean and variance of numbers x1, x2, …, xn can be calculated using the following formulas: 2 1 n 1 n 1 n mean x xi xi 2 xi 2 n i 1 n i 1 n i 1 The standard deviation is the square root of the variance. Assignment 4 Write a program to read a collection n of sets k of positive numbers, and calculate the mean, variance, and standard deviation for each set k of numbers. Write i for 1,..,i,..n and the corresponding calculated values in a file. The mean and variance of numbers x1, x2, …, xk can be calculated using the following formulas: 2 1 k 1 k 1 k mean x xi xi 2 xi 2 k i 1 k i 1 k i 1 The standard deviation is the square root of the variance. Assignment 5 Write a program that includes a function that calculates the equation F= xn sin x. Write the values n, x, and F on the screen and in a file ‘data_f.data’. Repeat the program for positive n. Assignment 6 Write a program that uses a module that calculates the equation: n x sin x F n Both denominator and nominator are calculated by two different functions. Write the values n, x, and F on the screen and in a file ‘data_f’. Repeat the program for positive n. Assignment 7 Write a program that reads the diameters and heights of several right circular cylinder and displays the circumference, total surface area (including the ends), and the volume of each. Circumference (C)= 2 r ; where r is the radius Total surface area = C (h+r); where h is the height Volume = r2 h. Use one subprogram to calculate above equations. Assignment 8 Write a function that accepts an integer N and returns an array containing the first N square root of 1, 2 , 3 , ...., N Repeat the program for positive N. Assignment 9 Write a program to read an array of numbers from the user, and use one subprogram to calculate the mean, variance, and standard deviation of the set of numbers. Use query control method to repeat the program. The mean and variance of numbers x1, x2, …, xn can be calculated using the following formulas: 1 k mean x x j k j 1 1 k xj x k j 1 2 The standard deviation is the square root of the variance.

DOCUMENT INFO

Shared By:

Categories:

Tags:

Stats:

views: | 2 |

posted: | 4/8/2012 |

language: | |

pages: | 11 |

OTHER DOCS BY ert554898

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.