-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMeat.java
More file actions
28 lines (25 loc) · 798 Bytes
/
Meat.java
File metadata and controls
28 lines (25 loc) · 798 Bytes
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
/**Filename: Meat
* @author: Kyle Makunga
*@version: 1.0
* Program to: Display the creation of subclass of Product superclass
* To compile: javac Meat.java
*/
public class Meat extends Product {
private String cutType;
public Meat(String name, double weight, String cutType) {
super(name, weight); //Create constructor with subclass attributes
this.cutType = cutType;
}
//getters and setters
public String getCutType() {
return cutType;
}
public void setCutType(String cutType) {
this.cutType = cutType;
}
//Override method in superclass
@Override
public void displayInfo() {
System.out.println("Meat: " + getName() + ", Weight: " + getWeight() + "kg, Cut: " + cutType);
}
}