-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProduct.java
39 lines (31 loc) · 932 Bytes
/
Product.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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author kdost
*/
public class Product {
private String name;
private double price;
private int amount;
public Product(String name, double price, int amount){
this.name = name;
this.amount = amount;
this.price = price;
}
public void printProduct(){
System.out.println(this.name + ", price " + this.price + " amount " + this.amount);
}
}
public class Main {
public static void main(String[] args) {
Product banana = new Product("Banana", 1.1, 13);
banana.printProduct();
// You can test your new class here, try e.g.:
// Product t = new Product("Banana", 1.1, 13);
// t.printProduct();
}
}