In Progress

java programming

Is a rational number is in the form A / B with a numerator and the denominator b. For example, 1/2, 3/5 and 8/2 are rationale

numbers. The denominator of a rational number can not be equal to 0, but the counter can be 0.

Is a rational number can not always be exactly represented in floating-point format,

for example, 1/3 = 0.33333. . ..

Java provides data types for integers and doubles, but not for rational numbers. Therefore you are requested

design, that rational numbers can be saved. Fracture object as a class Fraction for

representation of rational numbers we use a numerator and a denominator. The counter can include all whole numbers,

and the denominator must be a whole number greater than 0.

Write a Break in the class file [url removed, login to view] with the following attributes:

• Two integer instantiation variables numerator and denominator.

• Four different constructors, each with different parameters. Note that in the constructor with two parameters

must be determined whether the denominator is greater than 0 tested. If the denominator is less than zero, have to numerator and denominator

multiplied by -1. are. It must be the fault stored in simplified form, ie as

we specify the numerator and the denominator 2 12, we want to save the fraction 1/6.

Skills: Java

See more: variables in programming, types of programming, representation of integers, programming variables, programming types, programming simplified, programming object, programming data types, programming class, object instantiation, object in programming, integers and, integer and floating point representation, in java programming, floating point integers, floating point data representation, different types of programming, design rationale example, c programming data types, c programming break, counter programming, class programming, 33333, 0 1 integer programming, java programming class

About the Employer:
( 0 reviews ) Netherlands

Project ID: #4937491

Awarded to:


Hired by the Employer

€29 EUR in 1 day
(1 Review)