lab7.dvi CS105 Lab 7 Due 12:30 11/07/97 This lab will give you a chance to create a \class" representing a rational number (that is, the ratio of two integers, such as 1/3, also known as a fraction). We will talk more about why this is useful during the upcoming lectures, but you should be able to do the first few questions below based on last Wednesday's lecture. The parts about operators involve things that were mentioned briefly two or more weeks ago, so we can go over them againduring the lab period (or even the lectures) if you have questions. You can also take a look at my example \class complex" in the handouts folder in the CS105 folder on the CS/Math server. 1. Create a class \rational", in a file named \rational.h", with member functions \set to(int n, int d)" and \numerator()" and \denominator()", and a friend function \is zero" with one rational number parameter. 2. Define the functions mentioned in Question 1, in a file named \rational.c". Add this file to your pro ject. 3. Copy the first test function from test rational.c (in the Handouts folder in the CS105 folder on the CS/Math server) into your main.c. You should be able to compile and run this test. 4. Create operators for \+" (to add rational numbers) and << (to output a rational number to an output stream), and a constructor to create a rational number from a pair of integers (you may also have to add a constructor to create a rational number without any initial value, which could just be an empty function). The operator functions may either be friends of your class rational or not, but they should be declared somewhere in rational.h. 5. Copy the second test function from test rational.c. You should be able to compile and run both test functions now.