-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransport.java
More file actions
executable file
·66 lines (59 loc) · 1.61 KB
/
Transport.java
File metadata and controls
executable file
·66 lines (59 loc) · 1.61 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
/**
* This is the transport class
* This allows me to create new transport for the game. These are going to be public transport
* which travels suitable to the time period specified,like a train or a taxi. These will cost money
* and will take the players to specific or chosen locations. However due to their intoxication levels
* I have designed it so it only gives them the choice to use one word to describe their destination.
*
*This relied on a String which provides the name and an int which provides the cost of the public
*transport.
* @author
* @version
*/
public class Transport
{
// instance variables - replace the example below with your own
private String publicTransport;
public int cost;
/**
* Constructor for objects of class transport
*/
public Transport(String transportName, int transportPrice)
{
publicTransport = transportName;
cost = transportPrice;
}
/**
* @return transport name
*/
public String getTransportName()
{
return publicTransport;
}
/**
* @return transport price
*/
public int getTransportPrice()
{
return cost;
}
/**
* @param creates new String for transport name
*/
public void setTransport(String newTransport)
{
publicTransport = newTransport;
}
public void setPrice(int newPrice)
{
cost = newPrice;
}
/**
* @param prints transport information.
*/
public void printTransport()
{
System.out.println(publicTransport);
System.out.println(cost);
}
}