-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProducts.java
More file actions
45 lines (36 loc) · 826 Bytes
/
Copy pathProducts.java
File metadata and controls
45 lines (36 loc) · 826 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
38
39
40
41
42
43
44
45
package product;
import user.*;
import java.util.Scanner;
abstract public class Products
{
protected int quantity;
protected float price;
protected int id;
public static int counter=0;
protected Customer obj = new Customer();
public void setQuantity()
{
Scanner sc = new Scanner(System.in);
quantity = sc.nextInt();
}
public int getQuantity()
{
return quantity;
}
public float getPrice()
{
return price;
}
public float totalPrice()
{
float total=getQuantity()*getPrice();
System.out.print("Your total would be => "+total);
return total;
}
public int getId()
{
counter+=getQuantity();
id =counter;
return id;
}
}