-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduct.java
More file actions
28 lines (26 loc) · 1.09 KB
/
Product.java
File metadata and controls
28 lines (26 loc) · 1.09 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
package inheritance.webshop;
/**
* This class represents products in a webshop application. The class will be
* used as a base class for various product types in the next parts of the
* exercise.
*
* You will need to add the following private instance variables to the class:
* title (string), description (string) and price (double). The class already
* has a constructor that takes the values as arguments, but you need to
* complete its implementation.
*
* Also, create getter methods getTitle(), getDescription() and getPrice() to
* return the values of the instance variables.
*
* Finally, create a toString() method that returns a string representation of
* the product. You can decide yourself how the string should look like, but it
* must contain the title, description and price of the product.
*
* Note that this class itself does not utilize inheritance, but it will
* extended by other classes in the exercise.
*/
public class Product {
public Product(String title, String description, double price) {
// TODO: add instance variables and complete the constructor
}
}