In JAVA i have a class that i have the pseudo code but im having trouble filling in the methods and setters and such with the acutual code public class Range { private int minimum, maximum; // Set this.minimum and this.maximum to parameters // minimum and maximum, respectively, assuming minimum <= maximum. // Otherwise set both this.minimum and this.maximum to 0. public Range(int minimum, int maximum) { } // Call the two-parameter constructor with parameters 0 and maximum. public Range(int maximum) { } // Call the one-parameter constructor with parameter 100. public Range() { } // getter for maximum public int getMaximum() { } // getter for minimum public int getMinimum() { } // return the number of values in this range. public int getSize() { } // Set this.minimum to minimum, assuming minimum <= this.maximum. // Otherwise set this.mimimum to this.maximum. public void setMinimum(int minimum) { } // Set this.maximum to maximum, assuming maximum >= this.minimum. // Otherwise set this.maximum to this.minimum. public void setMaximum(int maximum) { } // return true iff n is at least minimum and n is at most maximum public boolean inRange(int n) { } // Return true iff this.minimum is at least r.minimum and // this. maximum is at most r.maximum. public boolean isSubrangeOf(Range r) { } // Return a new Range object representing // the intersection of this and r, or return null if that intersection is empty. public Range intersection(Range r) { } // Implement the equals methods, following the ClickCounter example from lecture public boolean equals(Object o) { } // Return a string representation of this, e.g. if this.minimum is 5 // and this.maximum is 7, you would return the String "(5,7)". public String toString() { } }
In JAVA
i have a class that i have the pseudo code but im having trouble filling in the methods and setters and such with the acutual code
public class Range {
private int minimum, maximum;
// Set this.minimum and this.maximum to parameters
// minimum and maximum, respectively, assuming minimum <= maximum.
// Otherwise set both this.minimum and this.maximum to 0.
public Range(int minimum, int maximum) {
}
// Call the two-parameter constructor with parameters 0 and maximum.
public Range(int maximum) {
}
// Call the one-parameter constructor with parameter 100.
public Range() {
}
// getter for maximum
public int getMaximum() {
}
// getter for minimum
public int getMinimum() {
}
// return the number of values in this range.
public int getSize() {
}
// Set this.minimum to minimum, assuming minimum <= this.maximum.
// Otherwise set this.mimimum to this.maximum.
public void setMinimum(int minimum) {
}
// Set this.maximum to maximum, assuming maximum >= this.minimum.
// Otherwise set this.maximum to this.minimum.
public void setMaximum(int maximum) {
}
// return true iff n is at least minimum and n is at most maximum
public boolean inRange(int n) {
}
// Return true iff this.minimum is at least r.minimum and
// this. maximum is at most r.maximum.
public boolean isSubrangeOf(Range r) {
}
// Return a new Range object representing
// the intersection of this and r, or return null if that intersection is empty.
public Range intersection(Range r) {
}
// Implement the equals methods, following the ClickCounter example from lecture
public boolean equals(Object o) {
}
// Return a string representation of this, e.g. if this.minimum is 5
// and this.maximum is 7, you would return the String "(5,7)".
public String toString() {
}
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images