COSC 1435 Lab 6

Purpose: This lab is to look at how to manipulate numbers, by developing a program that allows the input of two fractions, and then the addition and multiplication of those two fractions.

Due: Beginning of class, March 18, 2013

Requirements: Do the following:

1. This lab focuses on fractions. Write a program that inputs two fractions (a numerator and a denominator for each). The program should work properly for all fractions, except those that have a zero in either denominator. If the user enters 0 in a denominator, give an error message and exit the program. You will then use these two fractions to do the following:

You program does not need to reduce the result or handle improper fractions (you can do this for bonus points).


2. One of the key focuses of this program is on the user interface. Make sure both your input and output are clearly labeled so an untrained user can understand what occurred. As a minimum after the input is complete, your program should show the two fractions being added and multiplied, the resulting fraction (numerator and denominator), and the decimal equivalent. Use the output formatting tools to give consistent output. It is possible to make this output look very nice by using the formatting tools.

For example, this file contains acceptable output, which can be much improved:

3. Make sure your program is properly documented and good programming standards are followed, including properly type casting conversions between variable types.

4. Try your program with a variety of input values, to determine it works properly, including positive and negative numbers in the numerator and denominator. The output you provide should demonstrate your program being run multiple times using all types of inputs.

5. 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 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:

6. Bonus: Include code to handle reducing fractions and improper fractions. The instructor and lab assistants will assist you in these techniques, since the syntax required for these operations has not yet been discussed in class.

Program Submission. You will be submitting this lab via Blackboard. The teaching assistant will provide further instructions on how to accomplish this. Prepare the following:

Submit via blackboard following the instructions given during the lab

Grading Criteria: 100 points available for this lab. 20 bonus points for item 6.