-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModel.java
More file actions
44 lines (32 loc) · 1006 Bytes
/
Model.java
File metadata and controls
44 lines (32 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* Model.java
* Kevin Aka
* 12-20-23
*
* CS 86 Homework 57
*
* This file shows the steps the program takes to create the Model class.
* This class holds all the information for every vehicle in a list, such as
* their starting positon and color, so when it's time to draw the vehicles, the
* program goes down the list.
*
*/
import java.awt.*;
import java.util.*;
public class Model {
Bus davis_direct_bus;
Bus davis_all_stops_bus;
ArrayList <Bus> all_vehicles = new ArrayList<Bus>();
public Model(){
davis_direct_bus = new Bus(0, 110, 5, Color.red, "", "bus");
all_vehicles.add(davis_direct_bus);
davis_all_stops_bus = new Bus(110,110,5, Color.blue, "", "bus");
all_vehicles.add(davis_all_stops_bus);
}
public void draw(Graphics g){
for(int i = 0; i < all_vehicles.size(); i++){
Vehicles curr_vehicle = all_vehicles.get(i);
curr_vehicle.draw_vehicles(g);
}
}
}