COSC 1435 Lab 11
Purpose: This lab is to look at ways of using functions & loops.
Due: Before class on April 22, 2013
Requirements: Do the following:
1. Write a program that reads in a length in feet and inches and then converts that input to meters. There are 3.28084 feet in a meters and 12 inches in a foot. This program should use at least three functions. The first function accomplishes the user input. This function should validate (use a while loop) that only legal values are allowed (no negative numbers and or the inch value greater than 12). The second function does the conversion from feet and inches to meters (this function has no input or output statements). This function should return a double value that represents the length in meters as a double value. The third function outputs the results to the console (output is allowed). Make sure that this program works properly before going on to the next requirement. This is an interim program that helps you build to the final solution.
2. Write a second program that converts from meters to feet and inches. This program should use at least three functions. The first function accomplishes the user input and again does validation of the input. The second function does the conversion from meters to feet and inches (this function has no input or output statements). This function should return two values, an integer for the number of feet and a double for the inches value. At least one value must be passed back by reference or you may decide to pass both values back by reference. The third function outputs the results to the console. HINT: Convert the amount in meters to the total number of inches, then convert to feet and inches. Make sure that this program works properly before going on to the next requirement. This is an interim program that helps you build to the final solution.
3. Write a third program that combines the two conversions into a single program. This program should have a menu that allows the user to select which conversion to use (Program 6-10 from Gaddis would be a good starting point) and you should be able to use the functions you wrote for parts 1 & 2 to accomplish major parts of this program. This program should allow the user to enter multiple values to be converted and be able to do conversions either way, by changing the menu selection, without restarting the program. This is the only program you will be submitting to be graded.
4. One of the key focuses of this program is the user interface. Give careful though to the design of the user interface and make sure it is easy to use for a non-class member (think of one of your grandparents). That includes describing what the program does as part of the output.
5. Try your program with a variety of input values (including illegal values), to determine if it works properly.
6. This lab requires a lab report/documentation package. All of these items are not typically in the same file (source code and sample output should definitely be in their own files), but the main lab report file must reference each item by file name. Here is a sample lab report. The main lab report must either be a text file (with a .txt extension) or a Microsoft Word file (with a .doc extension). The lab report must includes the following or references (the file name that was attached to the mail) to the following information:
Program Submission. You will be submitting this lab via Blackboard. Prepare the following:
Submit via blackboard.