Repository navigation
Expand file tree
/
Copy pathSubs.java
More file actions
99 lines (86 loc) · 2.39 KB
/
Copy pathSubs.java
File metadata and controls
99 lines (86 loc) · 2.39 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
* This is a class for creating sub objects. It contains setters, getters, and variables.
*/
public class Subs {
/**
* Price of sub in us dollars as a float variable.
*/
private float subPrice;
/**
* Size of sub as an int.
*/
private int subLength;
/**
* Name of sub as a String.
*/
private String subName;
/**
* Default Constructor of Sub. Price is $0.00, size is 6in, and name is unspecified.
*/
public Pasta() {
this.subPrice = 0.00f;
this.subLength = 6;
this.subName = "unspecified";
}
/**
* Overloaded Constructor. User selects values for name, price, and size.
* @param subName the sub's name as String
* @param subPrice the sub's price as float
* @param subLength the sub's size as int
*/
public Sub(String subName, Float subPrice, String subLength) {
this.subName = subName;
this.subLength = subLength;
this.subPrice = subPrice;
}
/**
* Set sub price with this setter method.
* @param subPrice the sub's price as float
*/
public void setSubPrice(float subPrice) {
this.subPrice = subPrice;
}
/**
* Set sub size with this setter method.
* @param subLength the sub's size as String
*/
public void setSubLength(String subLength) {
this.subLength = subLength;
}
/**
* Set the sub name with this setter method.
* @param subName the sub's name as String
*/
public void setSubName(String subName) {
this.subName = subName;
}
/**
* Get the sub's name with this getter method.
* @return sub's name as String
*/
public String getSubName() {
return subName;
}
/**
* Get the sub's size with this getter method.
* @return sub's size as String
*/
public String getSubLength() {
return subLength;
}
/**
* Get the sub's price with this getter method.
* @return sub's price as float
*/
public float getSubPrice() {
return this.subPrice;
}
/**
* Gets the sub's name, size, and price with this overrided method.
* @return sub's name, size, and price as String in the format of "sub: , Size: , Price: $".
*/
@Override
public String toString() {
return "sub: " + subName + ", Size: " + subLength + ", Price: $" + subPrice;
}
}