Difference: Lab9 (2 vs. 3)

Revision 32015-11-17 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 9

Due: Nov 19, 11:55pm

Line: 30 to 30
 
  • (a/b) / (c/d) = (a*d) / (c*b)
  • -(a/b) = (-a/b)
  • (a/b) < (c/d) means (a*d) < (c*b)
Changed:
<
<
  • (a/b) = (c/d) means (a*d) = (c*b)
>
>
  • (a/b) = (c/d) means (a*d) = (c*b)
 Let any sign be carried by the numerator; keep the denominator positive.
Added:
>
>

Class member funtions

Will need at least the following class methods for the class Rational:

  • Rational(); // Defaul constructor
  • Rational(int x, int y); // constructor
  • Rational(int x); // Constructor of x/1
  • Rational add(Rational x);
  • Rational minus(Rational x);
  • Rational iimes(Rational x);
  • Rational divide(Rational x);
  • bool less(Rational x);
  • bool equals(Rational x);
  • void input(); // Inputs into this rational
  • void output(x); // Outputs this rational
 

Program Operation

Write a mainline that asks for two rational numbers to be typed in, and does all of the operations, just as seen in the example below:

Line: 49 to 64
  Thanks for using this program. \ No newline at end of file
Added:
>
>

Turn in

  1. Solution to the problem above
  2. Solution to 5/11 and 9/13
  3. Solution to -12/7 and 16/7
 \ No newline at end of file
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback