wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Ratios Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Ratios" Watch "Ratios" New topic
Author

Ratios

Arthur Zadrozny
Greenhorn

Joined: Sep 19, 2002
Posts: 3
If I have two numbers, 447 which represnts lets say apples, and 921 which represents oranges, how can I write the ratio of the number of apples to the number of oranges? Thanks.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Arthur Z,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
What have you tried or thought to try so far? Why did you do that? What did it do? What did you expect it to do?
Feel free to post code examples. When doing so, please be sure to surround the code with the [code] and [/code] UBB Tags. This will help to preserve the formatting of the code, thus making it easier to read and understand.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
You could try System.out.println("447 / 921 apples per orange");
There are also more general possibilities:

We can also do fractional numbers with decimal pips if you need them.
-Barry


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Neil Laurance
Ranch Hand

Joined: Jul 18, 2002
Posts: 183
Often ratios are displayed as n:1 or 1:n

Cheers, Neil
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ratios
 
Similar Threads
scanner regex question
Powerset algorithm
Help on Casting with Interfaces
fruit problem
Swing and ofbiz (type) frameworks