namespace Transport;
///
/// Represents management of all available vehicles and performed rides.
///
public sealed class TravelManagement
{
///
/// The max. distance a rickshaw can travel during a single rental
///
public const double MaxRickshawDistance = 50D;
private readonly List _vehicles;
///
/// Creates a new instance of the management
///
public TravelManagement()
{
_vehicles = [];
}
///
/// Loads the available vehicles from the Excel file at the given location
///
/// Path to the workbook
/// True if loading was successful; false otherwise
public bool InitializeFromFile(string filePath)
{
// TODO
var workbook = new XLWorkbook(filePath);
var rickshawSheet = workbook.Worksheet(Rickshaw.WorksheetName);
var carSheet = workbook.Worksheet(Car.WorksheetName);
// TODO
return false;
}
///
/// Attempts to rent a vehicle for the given distance and customer.
/// Important: the distance is (unrealistically) fixed: it will be
/// exactly the given value, neither shorter nor longer.
/// If a is requested but the distance exceeds
/// a is selected instead.
/// Only vehicles currently available (= not on a ride) are considered.
///
/// Name of the customer who desires to rent a vehicle
/// The distance for which the vehicle is rented
/// Desired vehicle type
/// The rented vehicle, if a matching one has been found
public Vehicle? RentVehicle(string customerName, double distance)
where TPreferredVehicle : Vehicle
{
// TODO
return null;
}
///
/// Creates an Excel workbook which contains a worksheet for every vehicle.
/// Each worksheet contains the detail travel log of all rentals for one vehicle.
///
/// Workbook containing travel log of all vehicles
public IXLWorkbook GetTravelLog()
{
IXLWorkbook workbook = new XLWorkbook();
// TODO
return workbook;
}
}