-
Notifications
You must be signed in to change notification settings - Fork 0
/
vehicle.cpp
46 lines (38 loc) · 1.07 KB
/
vehicle.cpp
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
#include <iostream>
#include <fstream>
#include "vehicle.hpp"
using namespace std;
machine::machine(string file_name)
{
ifstream read_vehicle('v' + file_name + ".txt");
read_vehicle >> speed;
read_vehicle >> traffic_speed;
read_vehicle >> line_price;
read_vehicle >> traffic_price;
read_vehicle >> get_in;
read_vehicle >> traffic_get_in;
read_vehicle >> start_traffic_time;
read_vehicle >> end_traffic_time;
}
int machine::get_in_time(Time t1)
{
if( t1.get_hour() >= start_traffic_time.get_hour() and t1.get_hour() < end_traffic_time.get_hour() and t1.get_noon() == start_traffic_time.get_noon() ) // check the noon later because traffic time for taxi is different.
{
return traffic_get_in ;
}
else
{
return get_in ;
}
}
int machine::get_path_time(Time t1)
{
if( t1.get_hour() >= start_traffic_time.get_hour() and t1.get_hour() < end_traffic_time.get_hour() and t1.get_noon() == start_traffic_time.get_noon() )
{
return traffic_speed ;
}
else
{
return speed ;
}
}