Home » Source Code » ERTY CODE JAVA

ERTY CODE JAVA

swannet23
2013-11-26 01:53:29
The author
View(s):
Download(s): 0
Point (s): 1 
Category Category:
AlgorithmAlgorithm ErlangErlang

Description

//Clase que almacena los datos del objeto 
public class Objeto implements Comparable<Objeto>{ 
 int peso; 
 int valor; 
 double ratio; 
  
 public Objeto(){ 
 peso = 0
 valor = 0
 ratio = -1
  
 public Objeto(int peso, int valor){ 
 this.peso = peso; 
 this.valor = valor; 
 if(peso > 0){ 
 ratio = this.valor / this.peso; 
 }else
 ratio = -1
 
 @Override 
 public int compareTo(Objeto o) { 
 int res = 0
 if((this.ratio > o.ratio) || 
 ((this.ratio == o.ratio) && (this.peso < o.peso))){ 
 res = -1
 }else if((this.ratio < o.ratio) || 
 ((this.ratio == o.ratio) && (this.valor > o.valor)) || 
 ((this.ratio == o.ratio) && (this.valor == o.valor) && 
 (this.peso < o.peso))){ 
 res = 1
 return res; 
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
cola.txt1.16 kB2012-06-08 14:26
Grafo.txt1.22 kB2012-06-08 14:26
Main.txt3.05 kB2012-06-08 14:27
Nodo.txt1.02 kB2012-06-08 14:27
Pila.txt1.20 kB2012-06-08 14:28
Recorrido.txt2.35 kB2012-06-08 14:29
...
Sponsored links

Comments

(Add your comment, get 0.1 Point)
Minimum:15 words, Maximum:160 words
  • 1
  • Page 1
  • Total 1

ERTY CODE JAVA (3.98 kB)

Need 1 Point(s)
Your Point (s)

Your Point isn't enough.

Get 22 Point immediately by PayPal

Point will be added to your account automatically after the transaction.

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more Points

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D