Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class PropertiesBook {
- private ArrayList<Property> properties = new ArrayList<>();
- public Property findCheapestProperty() {
- Property cheapestProperty = properties.get(0);
- for (int i = 0; i < properties.size(); i++) {
- if (properties.get(i).getPrice() < cheapestProperty.getPrice()) {
- cheapestProperty = properties.get(i);
- }
- }
- return cheapestProperty;
- }
- public ArrayList getProperties() {
- return properties;
- }
- public void addProperty(Property property) {
- this.properties.add(property);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement