Grantham University Week 4 Rational Fraction Questions

Advanced Programming in C++ – W4 Assignment

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Rational Fractions

Chapter 13 Programming Exercise #10 Page 983

Additional Requirements

Use a template so the class works with any kind of number (i.e. int, float, double)

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

fractionType num1(5, 6);

fractionType num1(5.1, 6.2);

Tip:   get your class working with integer values first for numerator and denominator and convert to a template after it is working with ints.   When converting to a template you may need to move all of your implementation into the .h header file.

Directions

You are to write a C++ program that meets the instruction requirements above. Use the assignment template to insert the assignment deliverables outlined above.

Deliverables

  • A description of your program.
  • Your C++ source code (do not submit screen shots).
  • A screenshot of your program running.
  • A short reflection outlining your experience developing the program.
  • Chapter 13 Programming Exercise #10 Page 983
    Rational fractions are of the form a/b, in which a and b are integers and b ≠ 0. In this exercise, by
    “fractions” we mean rational fractions. Suppose a/b and c/d are fractions. Arithmetic operations
    on fractions are defined by the following rules:
    a/b + c/d = (ad+bc)/bd
    a/b – c/d = (ad-bc)/bd
    a/b × c/d = ac/bd
    (a/b) / (c/d) = ad/bc; in which c/d≠0.
    Fractions are compared as follows: a/ b op c/d if ad op bc, in which op is any of the relational
    operations. For example, a/b < c/d if ad < bc. Design a class —say, fractionType—that performs the arithmetic and relational operations on fractions. Overload the arithmetic and relational operators so that the appropriate symbols can be used to perform the operation. Also, overload the stream insertion and stream extraction operators for easy input and output. Write a C++ program that, using the class fractionType, performs operations on fractions. Among other things, test the following: Suppose x, y, and z are objects of type fractionType. If the input is 2/3, the statement Cin >> x;
    should store 2/3 in x. The statement
    cout

    Still stressed from student homework?
    Get quality assistance from academic writers!

    Order your essay today and save 25% with the discount code LAVENDER