-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddress.cpp
More file actions
executable file
·78 lines (57 loc) · 1.73 KB
/
address.cpp
File metadata and controls
executable file
·78 lines (57 loc) · 1.73 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "address.h"
#include <iostream>
/*
CS202 ASSIGNMENT 1 : MAX SMILEY
file: address.cpp
This file provides the definitions for the classes prototyped in address.h.
Most of these functions seem self explanatory.
*/
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
Address::Address(): address(-1)
{}
Address::Address(int in_address): address(in_address)
{}
int Address::getAddress() const
{
return address;
}
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
Package::Package(): priority(-1), size(-1), weight(-1)
{}
Package::Package(int in_priority, int in_address, int in_size, int in_weight): Address(in_address),
priority(in_priority),
size(in_size),
weight(in_weight)
{}
int Package::getPriority()
{
return priority;
}
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
Edge::Edge(): length(-1), speed(-1)
{}
Edge::Edge(int in_address, int in_length, int in_speed): Address(in_address),
length(in_length),
speed(in_speed)
{}
int Edge::getLength() const
{
return length;
}
int Edge::getSpeed() const
{
return speed;
}
//returns time spend traveling in minutes.
int Edge::getTime() const
{
float l = length;
float s = speed;
float r = 60*(l/s);
return (int)r;
}
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////