-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaco.java
57 lines (55 loc) · 1.03 KB
/
Taco.java
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
public class Taco {
private String name;
private String location;
private double price;
public Taco()
{
this.name = this.location = "none";
this.price = 0.0;
}
public Taco(String aName, String aLoc, double aPrice)
{
//TODO Call mutators
this.setName(aName);
this.setLocation(aLoc);
this.setPrice(aPrice);
}
public String getName()
{
return this.name;
}
public String getLocation()
{
return this.location;
}
public double getPrice()
{
return this.price;
}
public void setName(String aName)
{
this.name = aName;
}
public void setLocation(String aLoc)
{
this.location = aLoc;
}
public void setPrice(double aPrice)
{
if(aPrice >= 0.0)
{
this.price = aPrice;
}
}
public String toString()
{
return this.name+" "+this.location+" "+this.price;
}
public boolean equals(Taco aTaco)
{
return aTaco != null &&
this.name.equals(aTaco.getName()) &&
this.location.equals(aTaco.getLocation()) &&
this.price == (aTaco.getPrice());
}
}