1 |
/** |
2 |
Describes a product with a description and a price |
3 |
*/ |
4 |
class Product |
5 |
{ |
6 |
/** |
7 |
Constructs a product from a description and a price. |
8 |
@param aDescription the product description |
9 |
@param aPrice the product price |
10 |
*/ |
11 |
public Product(String aDescription, double aPrice) |
12 |
{ |
13 |
description = aDescription; |
14 |
price = aPrice; |
15 |
} |
16 |
|
17 |
/** |
18 |
Gets the product description. |
19 |
@return the description |
20 |
*/ |
21 |
public String getDescription() |
22 |
{ |
23 |
return description; |
24 |
} |
25 |
|
26 |
/** |
27 |
Gets the product price. |
28 |
@return the unit price |
29 |
*/ |
30 |
public double getPrice() |
31 |
{ |
32 |
return price; |
33 |
} |
34 |
|
35 |
private String description; |
36 |
private double price; |
37 |
} |
38 |
|