MIT OpenCourseWare
  • OCW home
  • Course List
  • about OCW
  • Help
  • Feedback
  • Support MIT OCW

Swing 2D API

Source Code 

All code produced with Java™ software.
Java™ is a trademark of Sun Microsystems Inc.

NgonApp.java

NgonApp1.java

NgonApp2.java

NgonView.java

NgonView1.java

NgonView2.java

Announcements/Notices

Problem set 5 - Clarification for problem 2

The BusDrawing.java file that we gave you includes a line

double box = BusFrame.Y-200;

You can replace this line with the line:

double box = 300;

 
Readings/Psets

Chapter 7 315-328

 
Errata and Hints

Problem set 5 - More clarifications for problem 2

The parameter values you see in the screen shot for problem two are slightly incorrect. When input values are 0.0, 0.0, and 1.1 the outputs should be:

Headway: 24.06036392060625
No rtes: 4.628982353197658
Fare: 199.49696732828133
Rider:1306.4757144878142
Revenue: 2606.3794292836847
Cost: 26261.28571024372

For input values of 1.0, 2.0, and 2.0 the outputs should be:

Headway: 26.384317130342872
No rtes: 4.221257630045497
Fare: 755.522762321904
Rider:899.6009530966913
Revenue: 6796.689970710298
Cost: 21402.018114836384

Some students expressed alarm that each time they hit the "calculate" button, the output parameters changed, even with no changes in the input. Fear not, this is the correct behavior. (The bus velocity v depends on its previous value.)