ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 26 May 2017 My Price 11.00

public class RationalNumber

I will need a tutor on this assignment, I will attached something first and recheck this later next week, I kinda met some serious issue right now, I will put on tips after this is done by someone, I only have $2.00 in my account and I will figure out how to pay more.

 

Please start from below 

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) {
// }
}

 

 

CS 210
1. W. Li Assignment 8 (10 points) Chapter 8: Self-check problems #7, #11, #15, #19, #26, #27.
If you use 2nd edition: Self-check problems #7, #10, #13, #16, #23 and #24.
For your benefit, I suggest you complete all of the self-check problems on your own.
However, I will just collect the answers to the above six problems. Please type the answers into
a document.
a. NO NEED to copy original questions, just put down the question number and the answer.
b. Name the file as “LastnameFirstname8.doc” (or “.docx” or “.pdf”, where “Lastname” is
your last name, and “Firstname” is your first name), submit it online. 2. (30 points) Chapter 8: Programming Project #1 “Rational Number”
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”.
-- If both of the numerator and the denominator are negative, return positive. For
example, for -3 / -5, it returns “3/5”. CS 210 W. Li Assignment 8 If the numerator is positive and the denominator is negative, return the negative
sign in front of the numerator. For example, for 3 / -5, it returns “-3/5”
-- 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”).
-- 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.
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)

Answers

(11)
Status NEW Posted 26 May 2017 08:05 AM My Price 11.00

-----------

Attachments

file 1495786063-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)