-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbus.java
More file actions
48 lines (41 loc) · 1.45 KB
/
bus.java
File metadata and controls
48 lines (41 loc) · 1.45 KB
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
45
46
47
48
////////////////////////////////////////////////BUS 모델링///////////////////////////////////////////////////////
class bus extends Transportation{
int nowPassenger;
int bus_number;
String bus_form; // 운행, 차고지행
void start_driving(){
}
void changeForm_bus(){
if(fuelVolume<7){
bus_form = "차고지행";
}else if (fuelVolume < 10){
System.out.println("주유가 필요하다");
}
}
void onboarding_bus(int passenger){
if (bus_form == "운행"){
if (((nowPassenger+passenger) <= maxPassenger)){
nowPassenger += passenger;
System.out.println("탑승 승객 수 = "+passenger);
System.out.println("잔여 승객 수 = "+(maxPassenger-nowPassenger));
System.out.println("요금 확인 = "+(passenger*base_rate));
}else{
System.out.println("알럿 '최대 승객 수 초과'");
}
}
}
void changespeed_bus(int changespeed){
if(fuelVolume >= 10){
speed += changespeed;
}else{
System.out.println("주유량을 확인해 주세요");
}
}
bus(int bus_number) {
super(100,0 );
this.maxPassenger = 30;
this.bus_form = "운행";
this.base_rate = 1000;
System.out.println(bus_number+"번 버스 생성");
}
}