40 likes | 175 Vues
Homework #2: Functions and Arrays. By J. H. Wang Mar. 21, 2008. Programming Exercises. Write a function that takes three input parameters (of integers) and returns the sum and the average of the three numbers. Write a driver program that tests your function.
E N D
Homework #2:Functions and Arrays By J. H. Wang Mar. 21, 2008
Programming Exercises • Write a function that takes three input parameters (of integers) and returns the sum and the average of the three numbers. Write a driver program that tests your function. • Write a function leap() that determines if a year is a leap year. A year is a leap year if it is divisible by four, except that any year divisible by 100 is a leap year only if it is divisible by 400. Your function should accept the year as an integer. It returns 1 if called with a leap year, 0 otherwise.
Write a program to store an input list of ten integers in an array; then display a table similar to the following, showing each data value and what percentage each value is of the total of all ten values.
Submission • Due: 2 weeks (Apr. 4, 2008) • Account registration (if you haven’t done it yet) • http://140.124.182.228/UploadHomework/newuser.aspx • Homework uploading • http://140.124.182.228/UploadHomework/Home.aspx • Password changing • http://140.124.182.228/UploadHomework/changePW.aspx • Password recovery (if you forgot it) • http://140.124.182.228/UploadHomework/recoveryPW.aspx