Files
G4G0-1/Semester 1/Programming 1/Java/examples/projects/chapter16/taxi-company-outline/Demo.java
2024-01-15 20:14:10 +00:00

36 lines
794 B
Java
Executable File

/**
* Set up a passenger-source and taxi-company, to illustrate
* the scenario of requesting a pickup.
*
* @author David J. Barnes and Michael Kölling
* @version 2016.02.29
*/
public class Demo
{
private PassengerSource source;
private TaxiCompany company;
/**
* Create some sample objects for the demo.
*/
public Demo()
{
company = new TaxiCompany();
source = new PassengerSource(company);
}
/**
* Request a pickup for a new passenger.
* The request will fail in this version.
*/
public void pickupTest()
{
if(source.requestPickup()) {
System.out.println("Pickup request succeeded.");
}
else {
System.out.println("Pickup request failed.");
}
}
}