-
Notifications
You must be signed in to change notification settings - Fork 0
/
Item.java
45 lines (39 loc) · 912 Bytes
/
Item.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
/**
* PS Software Engineering WS2015 <br>
* <br>
*
* Abstract class that contains common fields (name) and methods that must be
* implemented by sub-classes
*
* @author Kevin Schoergnhofer
* @author Markus Seiwald
*
*/
public abstract class Item {
private String name;
public Item(String name) {
this.name = name;
}
/**
* gets Item name
*
* @return the name of the Item on which the method is invoked
*/
public String getName() {
return name;
}
/**
* gets Item price - for ItemList the price is the sum of its components
*
* @return the price of the Item on which the method is invoked
*/
public abstract double getPrice();
/**
* searches for the price of a certain Item
*
* @param itemName
* the name of the Item whose price should be found
* @return null if Item couldn't be found
*/
public abstract Double getPrice(String itemName);
}