This repository was archived by the owner on Nov 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerishable.java
More file actions
85 lines (73 loc) · 1.82 KB
/
Perishable.java
File metadata and controls
85 lines (73 loc) · 1.82 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import java.util.*;
/**
* Subclass for the Accessory class.
*
* @author George Broadley
* @version 1.0.0
*/
public class Perishable extends Accessory
{
// instance variables
private boolean isIrritant;
private String useByDate;
private int volume;
/**
* Constructor for the Perishable class
*
* @param toolName
* @param itemCode
* @param position
* @param cost
* @param isIrritant
* @param useByDate
* @param volume
*/
public Perishable(String itemName, String itemCode, String position, int cost, boolean isIrritant, String useByDate, int volume)
{
super(itemName, itemCode, position, cost);
this.isIrritant = isIrritant;
this.useByDate = useByDate;
this.volume = volume;
}
public Perishable() {}
/**
* Prints details of this tool.
*/
public void printDetails()
{
super.printDetails();
System.out.printf("%-25s: %s\n", "Is Irritant", isIrritant);
System.out.printf("%-25s: %s\n", "Use By Date", useByDate);
System.out.printf("%-25s: %s\n", "Volume", volume);
}
public void extractData(Scanner fieldScanner)
{
isIrritant = fieldScanner.nextBoolean();
useByDate = fieldScanner.next();
volume = fieldScanner.nextInt();
super.extractData(fieldScanner);
}
/**
* Getters and Setters below
*/
public boolean isIrritant()
{
return isIrritant;
}
public String getUseByDate()
{
return useByDate;
}
public int getVolume()
{
return volume;
}
public void setIrritant(boolean isIrritant)
{
this.isIrritant = isIrritant;
}
public void setUseByDate(String useByDate)
{
this.useByDate = useByDate;
}
}