Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In JAVA . Write a class for a Fraction. This class will hold the numerator and denominator of a fraction. Each time you write a

In JAVA . Write a class for a Fraction. This class will hold the numerator and denominator of a fraction. Each time you write a method, test that method in the Driver Class (So this program need to have two classes, the Fraction class and the driver class).. Add two fractions returning the sum in lowest terms, susbtract the two fractions returning the difference in lowest terms. multiply the two fractions and divide the two fractions , and finally compare the two fractions and determine and return the decimal value of the fraction. Include a static method to generate and return a random fraction that is between 0 and 1. A toString() method that returns a string in form of a/b .Here is a simple way to find the greatest common divisor of two numbers: start with the smaller of the two numbers and determine if the number goes into the larger of the two numbers evenly, if it does, this is the greatest commonn divisor, if not, repeately substract 1 from the value of the smallest number until you find a value that goes into both number evenly.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

1. In taxonomy which are the factors to be studied ?

Answered: 1 week ago

Question

1.what is the significance of Taxonomy ?

Answered: 1 week ago

Question

What are the advantages and disadvantages of leasing ?

Answered: 1 week ago

Question

Name is needed for identifying organisms ?

Answered: 1 week ago