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. Van.java 1 /** This class models a shuttle van. */ 4 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) { 10 11 12 13 14 15 16 17 18 19 20 21 55 } /** Boards passengers up to the capacity of this van. @param boardingPassengers the number of passengers attempting to board */ public void board(int boardingPassengers) { 25 26 27 28 } /** Drives the van and discharges the passengers. @param distance the distance driven */ public void drive(double distance) { } 38 40 41 42 43 /** Gets the number of passengers in this van. @return the number of passengers */ public int getPassengers() { 44 45 46 47 48 49 50 51 /** Gets the number of miles that this van has driven. @return the number of miles */ public double getMilesDriven(O 53 54 55 } VanTester.java 1 public class VanTester 2 { public static void main(String[) args) { Van vanl = new Van(8); vanl.board (3); System.out.println(van1.getPassengers()); System.out.println("Expected: 3"); vani, boardien System.out.println(van1.getPassengers()); System.out. - out.println("Expected: 8"); van1.drive(10); System.out.println(vanl.getPassengers()); ystem. out.println("Expected: 0"); . out.println(van1.getMilesDriven()); System.out. System.out.println("Expected: 10"); van1. board(6) System.out.println(van1.getPassengers()); System.out.println("Expected: 6"); van1.drive(12); System.out.println(van1.getPassengers()); System.out.println("Expected: 0"); System.out.println(van1.getMilesDriven()); System.out.println("Expected: 22"); } 25 26
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. Van.java 1 /** This class models a shuttle van. */ 4 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) { 10 11 12 13 14 15 16 17 18 19 20 21 55 } /** Boards passengers up to the capacity of this van. @param boardingPassengers the number of passengers attempting to board */ public void board(int boardingPassengers) { 25 26 27 28 } /** Drives the van and discharges the passengers. @param distance the distance driven */ public void drive(double distance) { } 38 40 41 42 43 /** Gets the number of passengers in this van. @return the number of passengers */ public int getPassengers() { 44 45 46 47 48 49 50 51 /** Gets the number of miles that this van has driven. @return the number of miles */ public double getMilesDriven(O 53 54 55 } VanTester.java 1 public class VanTester 2 { public static void main(String[) args) { Van vanl = new Van(8); vanl.board (3); System.out.println(van1.getPassengers()); System.out.println("Expected: 3"); vani, boardien System.out.println(van1.getPassengers()); System.out. - out.println("Expected: 8"); van1.drive(10); System.out.println(vanl.getPassengers()); ystem. out.println("Expected: 0"); . out.println(van1.getMilesDriven()); System.out. System.out.println("Expected: 10"); van1. board(6) System.out.println(van1.getPassengers()); System.out.println("Expected: 6"); van1.drive(12); System.out.println(van1.getPassengers()); System.out.println("Expected: 0"); System.out.println(van1.getMilesDriven()); System.out.println("Expected: 22"); } 25 26
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education