-
Notifications
You must be signed in to change notification settings - Fork 0
/
Satellite.java
73 lines (50 loc) · 1.7 KB
/
Satellite.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package com.company2;
/**
* Created by Benjamin R. on 30-07-2016.
*/
public class Satellite { }
/*private static class Experiment implements Comparable<Experiment> {
private double ratio;
private int weight;
public Experiment(double r, int w) {
ratio = r;
weight = w;
}
public double getratio(Experiment a){
return this.ratio;
}
public int getWeight(Experiment a){
return this.weight;
}
public String toString() {
return (" Experiment: benefit: "+ (ratio*weight) + " weight: "+ weight+ " ratio: "+ ratio);
}
@Override
public int compareTo(Experiment o) {
return 0;
}
}
public static void main(String[] args) {
Experiment a= new Experiment(2.0, 2);
Experiment b= new Experiment(1.5, 4);
Experiment c= new Experiment(2.5, 2);
Experiment d= new Experiment(1.66667, 3);
Experiment[] e= {a, b, c, d};
// Invoke a sort method
// Set maximum weight= 7
// Initialize cumulative weight, cumulative benefit= 0
for(int i = 0; i< e.length-1; i++){
ArrayList result = new ArrayList();
System.out.println(e[i].Compare(e[i+1]));
result.add(e[i].Compare(e[i]));
}
}
}
// Loop thru the sorted experiments
// Accumulate the weight until the max weight is reached
// Accumulate the benefit as each experiment is added
// Compute benefit as ratio*weight
// Print out each experiment added to the payload
// Break out of the loop when max weight is reached
// Print the total benefit
*/