Question: 8 . 1 7 . 1 : Write code that keeps count of passengers up to the capacity of this van. A shuttle van picks

8.17.1: Write code that keeps count of passengers up to the capacity of this van.
A shuttle van picks up passengers and drives them to a destination, where they leave the van. Keep a count of the boarding passengers, but don't allow boarding if the van is full. Update the odometer when the van drives.
/**
This class models a shuttle van.
*/
public class Van
{
// Instance variables
/* Your code goes here */
/**
Constructs a van with a given capacity.
@param maxPassengers the maximum number of passengers that this
van can hold
*/
public Van(int maxPassengers)
{
/* Your code goes here */
}
/**
Boards passengers up to the capacity of this van.
@param boardingPassengers the number of passengers attempting
to board
*/
public void board(int boardingPassengers)
{
/* Your code goes here */
}
/**
Drives the van and discharges the passengers.
@param distance the distance driven
*/
public void drive(double distance)
{
/* Your code goes here */
}
/**
Gets the number of passengers in this van.
@return the number of passengers
*/
public int getPassengers()
{
/* Your code goes here */
}
/**
Gets the number of miles that this van has driven.
@return the number of miles
*/
public double getMilesDriven()
{
/* Your code goes here */
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!