Questions tagged [rational-number]

A rational is a number that can be expressed as the ratio of two integers.

In mathematics, a rational number is any number that can be expressed as the quotient or fraction p/q of two integers, p and q, with the denominator q not equal to zero. Since q may be equal to 1, every integer is a rational number. The set of all rational numbers is usually denoted by a boldface Q (or blackboard bold (\mathbb{Q} in LaTeX), Unicode ℚ); it was thus denoted in 1895 by Peano after quoziente, Italian for "quotient".

110 questions
-2
votes
1 answer

Rational class for java can't run program

So we have to create a Rational class that does the following. Create a project in Java that includes a Rational class. The class represents Rational numbers. It should have only 2 fields num and denom. It should have the following public methods…
-2
votes
1 answer

Print rational values in python using tabulate?

I'd like to print a table of values, some of which are rational (a/b) and some just integers. Can tabulate do this? If so, how? If not, are there any other options?
user10831
  • 59
  • 1
  • 5
-3
votes
1 answer

I'm trying to write a program to determine if the input value is irrational or not by determining the number of digits. why won't it compile?

If the number of digits is infinite then I mark it as irrational and everything else is rational as it would be finite. I tired input 3.14 but it crashed and didn't compile the output of irrational or rational. import java.math.BigDecimal; import…
-4
votes
1 answer

what is the rational class in java?

I was assigned to make a rational class by java but I really don't understand what is required as below: Rational Implement a rational number class: Rational Augment your class with methods for: Initialization (Constructor): parameters are…
ZeroPh33r
  • 1
  • 1
  • 1
-4
votes
1 answer

How can I change string or int into a Rational?

Here is the code, System.out.print("Enter r1: "); r1 = in.next(); System.out.print("Enter r2"); r2 = in.next(); System.out.println(myR.addR(r1,r2)); r1 and r2 is initialize as Rational. Here is my…
laygnas
  • 1
  • 1
1 2 3 4 5 6 7
8