-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaco.java
65 lines (58 loc) · 1.13 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
58
59
60
61
62
63
64
65
public class Taco {
//Instance variables are attributes
private String name;
private String loc;
private double price;
//Constructors
public Taco()
{
this.name = this.loc = "none";
this.price = 0.0;;
}
public Taco(String aName, String aLoc, double aPrice)
{
//TODO Fill in mutators
this.setName(aName);
this.setLocation(aLoc);
this.setPrice(aPrice);
}
//Accessors
public String getName()
{
return this.name;
}
public String getLocation()
{
return this.loc;
}
public double getPrice()
{
return this.price;
}
//Mutators
public void setName(String aName)
{
this.name = aName;
}
public void setLocation(String aLoc)
{
this.loc = aLoc;
}
public void setPrice(double aPrice)
{
if(aPrice >= 0.0)
this.price = aPrice;
}
//Methods
public String toString()
{
return this.name + " " + this.loc + " " + this.price;
}
public boolean equals(Taco aTaco)
{
return aTaco != null &&
this.name.equalsIgnoreCase(aTaco.getName()) &&
this.loc.equalsIgnoreCase(aTaco.getLocation()) &&
this.price == aTaco.getPrice();
}
}