Skip to content

Mubshr07/Q4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ Console app of this following question

Q4: Rational Class:

Create a class called Rational for prforming arithmetic with fractions.

Use integer variables to represent the private data of the class

  1. Numerator
  2. Denominator

Provide a constructor that enable an object of this class to be initialized when it's declared. The constructor should contain default values in case no initializer are provided and should store the fraction in reduced form. For example, the fraction 2/4 would be stored in the object as 2 in the numerator and 4 in the denominator. Provide public member functions that perform each of the following tasks:

    i.		Adding two Rational numbers. The results should be stored in reduced form.<br>
    ii. 	Subtracting two Rational numbers. The results should be stored in reduced form.<br>
    iii.	Multiplying two Rational numbers. The results should be stored in reduced form.<br>
    iv.     Dividing two Rational numbers. The results should be stored in reduced form.<br>
    v.		Printing Rational numbers in the form a/b, where a is the numerator and b is the denominator.<br>
    vi. 	Printing Rational in floating-point format. 
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published