subject

A. Download the attached "RationalNumber. java" b. Background: a rational number represents a fraction, e. g. 3 / 5. Here, 3 is the numerator, and 5 is the denominator; both are integers (can be either positive or negative). The denominator cannot be 0.
c. Implement two constructors: public RationalNumber(int numerator, int denominator) It constructs a new rational number. You can assume that the denominator will never be 0. public RationalNumber() It constructs a new rational number to represent 0 / 1
d. Implement the two accessors: public int getDenominator() It returns this rational number’s denominator. For example, for 3 / 5, it returns 5. public int getNumerator() It returns this rational number’s numerator. For example, for 3 / 5, it returns 3.
e. Implement the toString method: public String toString() It returns a String representation of this rational number, such as "3/5". If the denominator is 1, omit it. For example, for 4 / 1, it returns "4". If the numerator is 0, omit denominator. For example, for 0 / 8, it returns "0". You do NOT need to worry about reduced form (e. g. for 3 / 6, just returns "3/6" is good enough, no need to return "1/2"), or negative numbers (e. g. for 3 / -5, just returns "3/-5" is enough, no need to return "-3/5").
f. Implement the methods to add, subtract, multiply and divide another rational number. Here is the "method signature" for add: public RationalNumber add(RationalNumber numberToAdd) In the method, you should compute and return the result for the addition. For example, if r1 is 3 / 5, r2 is -1 / 5, r1.add(r2) should return a value of 2 / 5. Whether you choose to update the value of r1 is your choice -- in other words, it won’t affect your grade, as long as the value returned from the method is correct. Again, you don’t need to worry about reduced form. Please make sure NOT to change the "method signatures" in the original file, otherwise you will receive significant penalty.
g. For this assignment, you are limited to the language features in Chapters 1 through 8 of the textbook. Arrays are allowed
h. Remember, your program will be graded both on "external correctness" and "internal design and style" (whether your source code follows the style guide)
i. Submit the final "RationalNumber. java" file (DO NOT change the file name)
this is the initial rational number. java file
// Student Name
public class RationalNumber {
// TODO: implement the following methods
// public RationalNumber(int numerator, int denominator) {
// } // public RationalNumber() {
// }
// public int getDenominator() {
// }
// public int getNumerator() {
// }
/ public String toString() {
// }
// public RationalNumber add(RationalNumber other) {
// }
// public RationalNumber subtract(RationalNumber other) {
// }
// public RationalNumber multiply(RationalNumber other) {
// }
// public RationalNumber divide(RationalNumber other) {
// }
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:40
When running anti-virus software , what could be a reason where recipitent is not guaranteed that data being streamed will not get interrupted?
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
In which job role will you be creating e-papers, newsletters and preiodicals
Answers: 1
question
Computers and Technology, 23.06.2019 16:50
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
You know the right answer?
A. Download the attached "RationalNumber. java" b. Background: a rational number represents a fract...
Questions
question
Mathematics, 06.06.2021 06:50
question
Social Studies, 06.06.2021 06:50
question
Mathematics, 06.06.2021 07:00
question
Computers and Technology, 06.06.2021 07:00
Questions on the website: 13722363