# I know this an easy question so pls help

• 10-28-2013, 10:15 AM
michael wamicha
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.
• 10-28-2013, 10:16 AM
gimbal2
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.
• 10-28-2013, 10:18 AM
SurfMan
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...
• 10-28-2013, 10:43 AM
michael wamicha
Re: I know this an easy question so pls help
c'mon man it is just another question
• 10-28-2013, 10:45 AM
gimbal2
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.
• 10-28-2013, 12:38 PM
JosAH
Re: I know this an easy question so pls help
Quote:

Originally Posted by gimbal2
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
• 10-28-2013, 01:02 PM
gimbal2
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.