Functions Worksheet


  1. Write a function called totsecs that has three parms: hours, minutes, and seconds. The function should compute and return the total number of seconds given by the hours, minutes, and seconds passed.

  2. Write the statements to call your function to convert 2 hours, 15 minutes, 32 seconds into seconds and print the result.

  3. Overload the totsecs function by creating a version that has two parms: hours and minutes. This version should compute and return the total number of seconds given by the hours and minutes passed.

  4. Write the statements to call your function to convert 3 hours, 22 minutes into seconds and print the result.

  5. Create another version of the totsecs function that has three parms: hours, minutes, and seconds. This version should have default values of zero for the minutes and for the seconds. Write a prototype for the function and write the function definition.

  6. Write the statement to call the function written in the previous question to convert 4 hours into seconds. Write the statement to call the function written in the previous question to convert 4 hours 37 minutes into seconds. Write the statements to call the function written in the previous question to convert 4 hours, 37 minutes, and 44 seconds into seconds.



Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2002