"The getStudentWithHighestAverageGrade() method should return the student who has the highest average grade among the list of students."
"The getStudentWithLowestAverageGrade() method should return the student with the lowest average grade."
(University class)
package com.codegym.task.task29.task2909.car;
import java.util.Date;
public class Car {
static public final int TRUCK = 0;
static public final int SEDAN = 1;
static public final int CABRIOLET = 2;
double fuel;
public double summerFuelConsumption;
public double winterFuelConsumption;
public double winterWarmingUp;
private int type;
private boolean driverAvailable;
private int numberOfPassengers;
public Car(int type, int numberOfPassengers) {
this.type = type;
this.numberOfPassengers = numberOfPassengers;
}
public int fill(double numberOfGallons) {
if (numberOfGallons < 0)
return -1;
fuel += numberOfGallons;
return 0;
}
public double getTripConsumption(Date date, int length, Date summerStart, Date summerEnd) {
double consumption;
if (date.before(summerStart) || date.after(summerEnd)) {
consumption = length * winterFuelConsumption + winterWarmingUp;
} else {
consumption = length * summerFuelConsumption;
}
return consumption;
}
public int getNumberOfPassengersThatCanBeCarried() {
if (!isDriverAvailable())
return 0;
if (fuel <= 0)
return 0;
return numberOfPassengers;
}
public boolean isDriverAvailable() {
return driverAvailable;
}
public void setDriverAvailable(boolean driverAvailable) {
this.driverAvailable = driverAvailable;
}
public void startMoving() {
if (numberOfPassengers > 0) {
fastenPassengerBelts();
fastenDriverBelt();
} else {
fastenDriverBelt();
}
}
public void fastenPassengerBelts() {
}
public void fastenDriverBelt() {
}
public int getMaxSpeed() {
if (type == TRUCK)
return 80;
if (type == SEDAN)
return 120;
return 90;
}
}