Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Default I know this an easy question so pls help

    Exercise 11.3. A rational number is a number that can be represented as
    the ratio of two integers. For example, 2=3 is a rational number, and you
    can think of 7 as a rational number with an implicit 1 in the denominator.
    For this assignment, you are going to write a class de nition for rational
    numbers.
    1. Create a new program called Rational.java that defines a class named
    Rational. A Rational object should have two integer instance vari-
    ables to store the numerator and denominator.
    2. Write a constructor that takes no arguments and that sets the numer-
    ator to 0 and denominator to 1.
    3. Write a method called printRational that takes a Rational object as
    an argument and prints it in some reasonable format.
    4. Write a main method that creates a new object with type Rational,
    sets its instance variables to some values, and prints the object.
    5. At this stage, you have a minimal testable program. Test it and, if
    necessary, debug it.
    6. Write a second constructor for your class that takes two arguments and
    that uses them to initalize the instance variables.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,354
    Rep Power
    6

    Default Re: I know this an easy question so pls help

    I don't get your logic. "Its an easy question SO help". No. Its an easy question so solve it yourself. If you want help, ask an actual question, don't dump your homework assignment.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,087
    Rep Power
    4

    Default Re: I know this an easy question so pls help

    For Gosling's sake, all the instructions are there man! Grab a copy of your favourite text editor and start typing! I have never seen assignments that take you more by the hand than this one...
    Last edited by SurfMan; 10-28-2013 at 11:09 AM. Reason: Typo

  4. #4
    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Default Re: I know this an easy question so pls help

    c'mon man it is just another question

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,354
    Rep Power
    6

    Default Re: I know this an easy question so pls help

    Its not a question, its a homework dump. If you want to cheat your way through life that's fine, but don't involve others in your misconducts. Now if you want to do this the right way, make a start yourself and when you get stuck THEN ask for help. If you can't even start this then you simply need to open your book and actually do some studying.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default Re: I know this an easy question so pls help

    Quote Originally Posted by gimbal2 View Post
    do some studying.
    Ouch, studying means reading and reading makes your eyeballs bleed; this new generation wants to google (at best) and blindly copy and paste the answers; what are computers invented for anyways, hm?

    kindest regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,354
    Rep Power
    6

    Default Re: I know this an easy question so pls help

    Yep. But I'm going to keep saying it, because to me not wanting to read is just another front for not wanting to use your brain. I'm all for bringing back wrist-slapping whenever someone makes that criminal act against themselves.

    And computers are wonderful, you can get books so easily through them. You don't even have to get up and go to a store to get one. You can just order a paper copy or a digital copy, depending on your reading taste. Or if you want to prevent committing a crime against yourself by committing a crime against the economy you can even get them for free with a tiny bit of effort and personal shame.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. easy question about interface..
    By turkey in forum New To Java
    Replies: 5
    Last Post: 09-21-2013, 04:43 PM
  2. Replies: 2
    Last Post: 01-26-2012, 05:17 AM
  3. Easy solvable question.
    By xneonx in forum New To Java
    Replies: 5
    Last Post: 10-22-2010, 02:35 PM
  4. Quick easy question
    By jigglywiggly in forum New To Java
    Replies: 8
    Last Post: 01-04-2010, 04:34 PM
  5. Easy question
    By JavaNoob in forum New To Java
    Replies: 10
    Last Post: 08-03-2007, 11:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •