-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSales.java
More file actions
32 lines (25 loc) · 931 Bytes
/
Sales.java
File metadata and controls
32 lines (25 loc) · 931 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
/*
* THIS IS THE SALES CLASS WHICH IS A SUBCLASS OF THE EMPLOYEE CLASS AND INHERITS THE NAME FROM THE SUPERCLASS
* THIS CLASS ALSO HAS UNIQUE METHODS FOR THE SALES EMPLOYEES
* */
public class Sales extends Employee{
// PRIVATE FIELD DECLARATION
private int productsSold = 0;
// CONSTRUCTOR METHOD WHICH INHERITS THE NAME FROM THE SUPERCLASS
public Sales(String name){
super(name);
}
// METHOD WHICH ALLOWS SALES EMPLOYEE TO MEET A CUSTOMER
public void meetCustomer(){
System.out.println("\n"+this.getName()+" met a new customer\n");
}
// METHOD WHICH ALLOWS SALES EMPLOYEE TO SELL A PROCUCT
public void sellProduct(){
System.out.println("\n"+this.getName()+" sold a product\n");
this.productsSold++;
}
// METHOD WHICH RETURNS THE PRODUCTS SOLD FOR THIS SALES EMPLOYEE
public int returnProductsSold(){
return productsSold;
}
}