Find Jobs
Hire Freelancers

class rational numbers

$15-20 USD

Completed
Posted almost 21 years ago

$15-20 USD

Paid on delivery
This must be done in C++ not C. Define a class for rational numbers. A rational number is a number that can be represented as the quotient of two integers. Represent rational numbers as two values of type int, one for the numerator and one for the denominator. Call the class Rational. Include a constructor with two arguments that can be used to set the member variables of an object to any legitimate values. Also include a constructor that has only a single parameter of type int; call this single parameter whole_number and define the constructor so that the object will be initialized to the rational number whole_number/1. Also include a default constructor that initializes an object to 0(that is, to 0/1). Overload the input and output operators >> and <<. Numbers are to be input and output in the form 1/2, 15/32, 300/401, and so forth. Note that the numerator , the denominator, or both may contain a minus sign, so -1/2, 15/-32, and -300/-401 are all possible inputs. Overload all of the following operators so that they correctly apply to the type Rational: ==,<,<=,>,>=,+,-,*, and /. Also write a test program to test your class. Hints: Two rational numbers a/b and c/d are equal if a*d equals c*b. If b and d are positive rational numbers, a/b is less than c/d provided a*d is less than c*d. You should include a function to normalize the values stored so that, after normalization, the denominator is positive and the numerator and denominator are as small as possible. For example, after normalization 4/-8 would be represented the same as -1/2. You should also write a test program to test your class. ## Deliverables 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request. 3) Complete ownership and distribution copyrights to all work purchased. 4) Must be Done in C++ not C ## Platform Must work in windows platform in Microsoft VB.
Project ID: 2936866

About the project

6 proposals
Remote project
Active 21 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$9 USD in 14 days
4.9 (170 reviews)
5.9
5.9
6 freelancers are bidding on average $12 USD for this job
User Avatar
See private message.
$17 USD in 14 days
4.9 (214 reviews)
5.9
5.9
User Avatar
See private message.
$17 USD in 14 days
5.0 (34 reviews)
4.6
4.6
User Avatar
See private message.
$4.25 USD in 14 days
4.7 (47 reviews)
4.3
4.3
User Avatar
See private message.
$12.75 USD in 14 days
4.0 (5 reviews)
3.7
3.7
User Avatar
See private message.
$10.63 USD in 14 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
5.0
6
Member since Apr 17, 2003

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.