Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Running the Car Simulation - Intro to Java Programming

Get Embed Code
4 Languages

Showing Revision 4 created 05/24/2016 by Udacity Robot.

  1. Now you've written a lot of code and mercifully the application is nearly done.
  2. I'll give you the final piece. Here in the CarShareApp class, you make a
  3. simulation object, we ask it to read it's input. Then we load the passengers,
  4. and drive the cars. Also, so that you see what's going on, I've added a couple
  5. of print statements to the car class. Here in the tryToAdd method, we print out
  6. whenever the driver has picked up a passenger. And in the drive method, we
  7. print out, whenever the driver has dropped off a passenger. Now I would like
  8. you to, run the car share app, with these inputs here. So Jane has a car, that
  9. can hold four people including herself, wants to go to destination four. Fred
  10. has a two seater wants to go to destination two. And these are all passengers,
  11. they want to go to these destinations. The minus one signifies the end of
  12. input. Go ahead and run the app, and tell me in which order do passengers get
  13. dropped off.