Make a c++ program containing a class fraction

Assignment Help Computer Engineering
Reference no: EM1331732

Design a C++ program containing a class Fraction. The class data should have two variables numerator and denominator, both of type integer, to represent the fraction numerator/denominator. The fraction representation within the object must allow no simplification. That is, the numerator and denominator have to have no common divisor different from 1. For example, the fraction 4/6 must be represented as 2/3.

Be sure to implement the following features:

1. The class constructor must take two integers numbers (numerator and denominator).
2. For negative fractions, the numerator must be negative and denominator must be positive.
3. Include the method simplify that takes two numbers and returns a fraction object (representing a fraction that cannot be simplified).
4. Include a method add that takes two fraction objects and returns their sum (as a fraction object).
5. Include a method diff that takes two fraction objects and returns their difference (as a fraction object).
6. Implement overloaded operators + and - for addition and subtraction of fractions.
7. Implement overloaded comparison operators == and != for comparing two fraction objects.

Reference no: EM1331732

Questions Cloud

Use qualitative versus quantitative forecasts : As a strategist for a local bank, explain when you would use qualitative versus quantitative forecasts.
Maximizing element of diverse workforce : How can the different perspectives be addressed for each group to maximize this element of a diverse workforce?
Define electronic human resource management : Define electronic human resource management (HRM) and indicate its implications for five HRM practices. This solution is over 300 words long.
Describing the irac issues : Fully describe each of these ("IRAC") Issues, Rules, Application and Conclusion steps of the legal analysis process. Please include in your description the major role that the "facts" have in each step of the legal analysis.
Make a c++ program containing a class fraction : construct a C++ program containing a class Fraction. The class data should have two variables numerator and denominator, both of type integer, to represent the fraction numerator/denominator.
Environmental scanning strategy formulation : The assignment is a paper pertaining to Microsoft's Go to Market Strategy for Azure in India. It must discuss Microsoft in India, Information Technology in India pertaining to Mcrosoft Azure and the impact of cloud computing.
Describe the problem or protect the situation from occurring : Describe the problem or protect the situation from occurring
Cultural diversity in organization impact company-s culture : List the important factors that a manager should keep in mind if his or her organization has a diverse workforce. How does cultural diversity in an organization impact the company's culture?
A program that would calculate and print the parking charges : A parking garage charges a atleast fee of $2.00 to park for up to 3 hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of 3 hours.

Reviews

Write a Review

Computer Engineering Questions & Answers

  System analysis and design

In the System Analysis and Design: Mixing Techniques – The question “Whether the structured techniques and object-oriented techniques can be mixed.

  Benefits of ansi/tia/eia cabling standards

Discuss about the benefits of the ANSI/TIA/EIA cabling standards in detail and also explain why telecommunications managers must be familiar with them.

  Designing the calculator program

Develop a calculator program which will subtract, add, multiply, or divide two numbers input given by a user. If user selects division, do not permit the user to divide by 0

  Calculate the output value of problem

Design a program that reads in a text file with drawing commands and then outputs a bitmap with all the items drawn correctly

  Use a bubble sort algorithm in c++

use a Bubble Sort algorithm in C++ that generates a list of 10 random integers.

  How program to document the program internally

It will be necessary for you to access Service Request: SR-kf-008, Tax Calculator from the Virtual Organizations portal. Complete Change Request #1. Insert comments in the program to document the program internally. Attach a design flow chart to a..

  How pipes and tcp/ip sockets named libraries differ

What are the various kinds of clients that can be used to connect to SQL Server 2000 and the network requirements necessary for successful communications between the client and server.

  Compare and contrast two network operating systems

Why these would be appropriate for a client - in helping them make the best decision for their organization - as they would like to have a networking system which links the systems of all of their locations.

  Find whether the year entered from the keyboard

create a C program to determine whether the year entered from the keyboard is a leap year. Display a message indicating whether the year is or is not a leap year.

  Use that both versions of average()

Create a class called CollegeCourse with. use that both versions of average()

  The ajax extensions tab of the toolbox

Inside the ContentTemplate element of the UpdatePanel server control add the standard RadioButtonList server control, Label server control and Button server control.

  What is home wireless network and security

What is home wireless network and security Methodology- Review topics covered in lecture hours, from textbook, reference books plus online research, to behaviour a comprehensive study about wireless network security implementation at home.

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