Rational.cpp - Course 1205 Fall 2020 Student Name Harleen...

This preview shows page 1 - 2 out of 2 pages.

/************ * Course: 1205, Fall 2020 * Student Name: Harleen Jhamat * Student ID: 000435811 **************/ /* Question1. Create a class called Rational for performing arithmatic with fractions. Then write a program to test your class.Use integer variables to represent the private data of the class, meaning the numeratorand the denominator.Provide a constructor that enables an object of this class to be initialized when it's declared. Provide public member functions that perform each of the following tasks :
a) add -- Adds 2 rational numbers.Result should be stored in reduced form. b) subtract -- Subtracts 2 rational numbers.Store result in reduced form. c) multiply -- Multiplies 2 rational numbers.Store result in reduced form.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture