Results 1 to 7 of 7
- 10-28-2013, 10:15 AM #1
Member
- Join Date
- Oct 2013
- Posts
- 8
- Rep Power
- 0
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 denition for rational
numbers.
1. Create a new program called Rational.java that definesa 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 #2
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 12
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
- 10-28-2013, 10:18 AM #3
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
- 10-28-2013, 10:43 AM #4
Member
- Join Date
- Oct 2013
- Posts
- 8
- Rep Power
- 0
Re: I know this an easy question so pls help
c'mon man it is just another question
- 10-28-2013, 10:45 AM #5
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 12
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
- 10-28-2013, 12:38 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 28
Re: I know this an easy question so pls help
Build a wall around Donald Trump; I'll pay for it.
- 10-28-2013, 01:02 PM #7
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 12
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
-
easy question about interface..
By turkey in forum New To JavaReplies: 5Last Post: 09-21-2013, 04:43 PM -
i am new and this is probably an easy question help please
By elvis0288 in forum New To JavaReplies: 2Last Post: 01-26-2012, 05:17 AM -
Easy solvable question.
By xneonx in forum New To JavaReplies: 5Last Post: 10-22-2010, 02:35 PM -
Quick easy question
By jigglywiggly in forum New To JavaReplies: 8Last Post: 01-04-2010, 04:34 PM -
Easy question
By JavaNoob in forum New To JavaReplies: 10Last Post: 08-03-2007, 11:28 PM
Bookmarks