Номера всех автомобилей, имеющих черный цвет или нулевой пробег. // filter + map Количество уникальных моделей в ценовом диапазоне от 700 до 800 тыс. // distinct + filter
о656са121|LadaVesta|Blue|2000|750000
н455сх178|ToyotaCamry|Black|500|1500000
а787ук197|KiaRio|Green|0|795000
р435ав777|BMW|Black|3560|3000000
public class Main {
public static void main(String[] args) {
try (BufferedReader reader = new BufferedReader(new FileReader("auto.txt"))) {
reader.lines()
.forEach(line -> System.out.println(line));
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
}
}
public class Auto {
private String carNumber;
private String carModel;
private String carColor;
private int mileage;
private int price;
public Auto(String carNumber, String carModel, String carColor, int mileage, int price) {
this.carNumber = carNumber;
this.carModel = carModel;
this.carColor = carColor;
this.mileage = mileage;
this.price = price;
}
public String getCarNumber() {
return carNumber;
}
public void setCarNumber(String carNumber) {
this.carNumber = carNumber;
}
public String getCarModel() {
return carModel;
}
public void setCarModel(String carModel) {
this.carModel = carModel;
}
public String getCarColor() {
return carColor;
}
public void setCarColor(String carColor) {
this.carColor = carColor;
}
public int getMileage() {
return mileage;
}
public void setMileage(int mileage) {
this.mileage = mileage;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
}