-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProduct.java
More file actions
37 lines (29 loc) · 872 Bytes
/
Product.java
File metadata and controls
37 lines (29 loc) · 872 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
29
30
31
32
33
34
35
36
37
/**Filename: Product
* @author: Kyle Makunga
*@version: 1.0
* Program to: Display the creation of abstract supeclass for inheritance
* To compile: javac Product.java
*/
public abstract class Product {
private String name;
private double weight; // in kg
//Explicitly declared Product constructor with product attributes
public Product(String name, double weight) {
this.name = name;
this.weight = weight;
}
//getters and setters
public String getName() {
return name;
}
public double getWeight() {
return weight;
}
public void setName(String name) {
this.name = name;
}
public void setWeight(double weight) {
this.weight = weight;
}
public abstract void displayInfo(); //method to be overridden in subclasses
}