Write a fraction class whose objects will represent fraction

Assignment Help C/C++ Programming
Reference no: EM13810130

Write a fraction class whose objects will represent fractions. You should provide the following member functions:

  1. Two constructors, a default constructor which assigns the value 0 to the fraction, and a constructor that takes two parameters. The first parameter will represent the initial numerator of the fraction, and the second parameter will represent the initial denominator of the fraction.
  2. Arithmetic operations that add, subtract, multiply, and divide fractions. These should be implemented as value returning functions that return a fraction object. They should be named addedTo, subtract, multipliedBy, and dividedBy.
  3. A boolean operation named isEqualTo that compares two fraction objects for equality.
  4. An output operation named print that displays the value of a fraction object on the screen in the form numerator/denominator.

Your class should have exactly two data members, one to represent the numerator of the fraction being represented, and one to represent the denominator of the fraction being represented.

When adding or subtracting fractions, remember that you must first find the common denominator. The easy way to do this is to multiply the denominators together and use that product as the common denominator.

Reference no: EM13810130

Questions Cloud

Is game of life alive : Is Game of Life alive
How long would it take a car to return : How long would it take a car to return to its starting place if it traveled 180 m/s average speed of 90 km/hr and returned to its starting place along the same straightline path?
Discuss the differences and importance : Research and discuss the differences and importance of : IPPS, OPPS, MPFS and DMEPOS. Which provider type is paid by which method? What are the payment expectations for each type? What is the potential implication of a case mix involving IPPS, OPP..
Write a response paper about the essay times in history : Write a response paper about the essay "Times in history".
Write a fraction class whose objects will represent fraction : Write a fraction class whose objects will represent fractions. You should provide the following member functions: Two constructors, a default constructor which assigns the value 0 to the fraction, and a constructor that takes two parameters
Write response paper about novel the picture of dorian gray : Write a response paper about the novel "The picture of Dorian Gray" by Oscar Wilde.
Communication and crisis planning : Develop an Emergency Management Planning Committee
Identify potential weaknesse from quality web design company : Identify potential weaknesses from either the Aircraft Solutions or Quality Web Design Company
Estimate the surface temperature of the sun : Estimate the surface temperature of the sun - Assuming the earth behaves like a blackbody, how much energy is absorbed per unit time. What is its equilibrium temperature if all this energy is re-radiated back into space?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd