Repository navigation
Expand file tree
/
Copy pathPasta.java
More file actions
99 lines (86 loc) · 2.45 KB
/
Copy pathPasta.java
File metadata and controls
99 lines (86 loc) · 2.45 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 pasta objects. It contains setters, getters, and variables.
*/
public class Pasta {
/**
* Price of dish in us dollars as a float variable.
*/
private float dishPrice;
/**
* Size of dish as a String.
*/
private String dishSize;
/**
* Name of dish as a String.
*/
private String dishName;
/**
* Default Constructor of Pasta. Price is $0.00, size is Regular, and name is unspecified.
*/
public Pasta() {
this.dishPrice = 0.00f;
this.dishSize = "regular";
this.dishName = "unspecified";
}
/**
* Overloaded Constructor. User selects values for name, price, and size.
* @param dishName the dish's name as String
* @param dishPrice the dish's price as float
* @param dishSize the dish's size as String
*/
public Pasta(String dishName, Float dishPrice, String dishSize) {
this.dishName = dishName;
this.dishSize = dishSize;
this.dishPrice = dishPrice;
}
/**
* Set dish price with this setter method.
* @param dishPrice the dish's price as float
*/
public void setDishPrice(float dishPrice) {
this.dishPrice = dishPrice;
}
/**
* Set dish size with this setter method.
* @param dishSize the dish's size as String
*/
public void setDishSize(String dishSize) {
this.dishSize = dishSize;
}
/**
* Set the dish name with this setter method.
* @param dishName the dish's name as String
*/
public void setDishName(String dishName) {
this.dishName = dishName;
}
/**
* Get the dish's name with this getter method.
* @return dish's name as String
*/
public String getDishName() {
return dishName;
}
/**
* Get the dish's size with this getter method.
* @return dish's size as String
*/
public String getDishSize() {
return dishSize;
}
/**
* Get the dish's price with this getter method.
* @return dish's price as float
*/
public float getDishPrice() {
return this.dishPrice;
}
/**
* Gets the dish's name, size, and price with this overrided method.
* @return dish's name, size, and price as String in the format of "Dish: , Size: , Price: $".
*/
@Override
public String toString() {
return "Dish: " + dishName + ", Size: " + dishSize + ", Price: $" + dishPrice;
}
}