fbpx

Rational Numbers Assignments | Online Homework Help

Description

Define a class for rational numbers. Please download the Test program and add your code for submission.

A rational number is a number that can be represented as the quotient of two integers. For example, 1/2, 3/4, 64/2, and so forth are all rational numbers. (By 1/2, etc., we mean the everyday meaning of the fraction, not the integer division this expression would produce in a C++ program.) Represent rational numbers as two values of type int, one for the numerator and one for the denominator. Call the class Rational.

Include:

  1. a constructor with two arguments that can be used to set the
    member variables of an object to any legitimate values.
  2. 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.
  3. a default constructor that initializes an object to 0 (that is, to 0/1).

Click Here to Place Order           

Overload:

  1. 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 also possible inputs.
  2. all of the following operators so that they correctly apply to the type
    Rational: ==, <, <=, >, >=, +, -, *, and /.

(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*b. 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.)

Requirements

  1. DOWNLOAD TEST PROGRAM and add your code for this lab. Do not change any code that’s already inside the test program, but add your class member variables and function definition and implementations
  2. Follow the ADT (Abstract Data Type) guideline to implement the required class.
  3. Comment well in your program and any functions you use

Test Cases

1/2, -1/2, 4, 0, -/12 (should cause error)

Demo

Welcome to the Rational World of Wonders!
Please enter a rational number for this calculation:
1/2
1/2 + 1/2 = 1
1/2 - 1/2 = 0
1/2 * 1/2 = 1/4
1/2 / 1/2 = 1
1/2 == 1/2 : true
1/2 < 1/2 : false
1/2 <= 1/2 : true
1/2 > 1/2 : false
1/2 >= 1/2 : true
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Choose Us

Quality Papers

At Myhomeworkwriters.com, we always aim at 100% customer satisfaction. As such, we never compromise o the quality of our homework services. Our homework helpers ensure that they craft each paper carefully to match the requirements of the instruction form.

Professional Academic Writers

With Myhomeworkwriters.com, every student is guaranteed high-quality, professionally written papers. We ensure that we hire individuals with high academic qualifications who can maintain our quality policy. These writers undergo further training to sharpen their writing skills, making them more competent in writing academic papers.

Affordable Prices

Our company maintains a fair pricing system for all academic writing services to ensure affordability. Our pricing system generates quotations based on the properties of individual papers.

On-Time delivery

My Homework Writers guarantees all students of swift delivery of papers. We understand that time is an essential factor in the academic world. Therefore, we ensure that we deliver the paper on or before the agreed date to give students ample time for reviewing.

100% Originality

Myhomeworkwriters.com maintains a zero-plagiarism policy in all papers. As such, My Homework Writers professional academic writers ensure that they use the students’ instructions to deliver plagiarism-free papers. We are very keen on avoiding any chance of similarities with previous papers.

Customer Support 24/7

Our customer support works around the clock to provide students with assistance or guidance at any time of the day. Students can always communicate with us through our live chat system or our email and receive instant responses. Feel free to contact us via the Chat window or support email: support@myhomeworkwriters.com.

Try it now!

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Homework Writing Services

My Homework Writers holds a reputation for being a platform that provides high-quality homework writing services. All you need to do is provide us with all the necessary requirements of the paper and wait for quality results.

Essays

Essay Writing Services

At My Homework Writers, we have highly qualified academic gurus who will offer great assistance towards completing your essays. Our homework writing service providers are well-versed with all the aspects of developing high-quality and relevant essays.

Admissions

Admission and Business Papers

With Myhomeworkwriters.com, we will help you secure a position at your desired institution. Our essay writing services include the crafting of admissions papers. We will still help you climb your career ladder by helping you write the official papers that will help you secure a job. We will guide you on how to write an outstanding portfolio or resume.

Editing

Editing and Proofreading

Myhomeworkwriters.com has a professional editorial team that will help you organize your paper, paraphrase it, and eliminate any possible mistakes. Also, we will help you check on plagiarism to ensure that your final paper posses quality and originality.

Coursework

Technical papers

My Homework Writers harbors professional academic writers from diverse academic disciplines. As such, we can develop homework writing services in all academic areas. The simplicity or complexity of the paper does not affect the quality of homework writing services.