Question: Please help me to solve these code A shuttle van picks up passengers and drives them to a destination, where they leave the van. Keep

Please help me to solve these code

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 dont allow boarding if the van is full. Update the odometer when the van drives.

Van.java

/** This class models a shuttle van. */ public class Van { // Instance variables . . .

/** Constructs a van with a given capacity. @param maxPassengers the maximum number of passengers that this van can hold */ public Van(int maxPassengers) { . . . }

/** Boards passengers up to the capacity of this van. @param boardingPassengers the number of passengers attempting to board */ public void board(int boardingPassengers) { . . . }

/** Drives the van and discharges the passengers. @param distance the distance driven */ public void drive(double distance) { . . . }

/** Gets the number of passengers in this van. @return the number of passengers */ public int getPassengers() { . . . }

/** Gets the number of miles that this van has driven. @return the number of miles */ public double getMilesDriven() { . . . } }

A shuttle van picks up passengers and drives them to a destination, where they leave the van. Store the names of the boarding passengers. Don't allow boarding if the van is full. Update the odometer when the van drives.

Van.java

import java.util.ArrayList;

/** This class models a shuttle van. */ public class Van { // Instance variables . . .

/** Constructs a van with a given capacity. @param maxPassengers the maximum number of passengers that this van can hold */ public Van(int maxPassengers) { . . . }

/** Boards a passengers up to the capacity of this van. @param name the name of the passenger attempting to board */ public void board(String name) { . . . }

/** Drives the van and discharges the passengers. @param distance the distance driven */ public void drive(double distance) { . . . }

/** Gets the passengers in this van. @return a list of passengers */ public ArrayList getPassengers() { . . . }

/** Gets the number of miles that this van has driven. @return the number of miles */ public double getMilesDriven() { . . . } }

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 Databases Questions!