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 pathElectricTool.java
More file actions
77 lines (66 loc) · 1.65 KB
/
ElectricTool.java
File metadata and controls
77 lines (66 loc) · 1.65 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
import java.util.*;
/**
* Subclass for the Tool class.
*
* @author George Broadley
* @version 1.0.0
*/
public class ElectricTool extends Tool
{
// instance variables
private boolean rechargeable;
private String power;
/**
* Constructor for the ElectricTool class
*
* @param toolName
* @param itemCode
* @param timesBorrowed
* @param onLoan
* @param cost
* @param weight
* @param rechargeable
* @param power
*/
public ElectricTool(String toolName, String itemCode, int timesBorrowed, boolean onLoan, int cost, int weight, boolean rechargeable, String power)
{
super(toolName, itemCode, timesBorrowed, onLoan, cost, weight);
this.rechargeable = rechargeable;
this.power = power;
}
public ElectricTool() {}
/**
* Prints details of this tool.
*/
public void printDetails()
{
super.printDetails();
System.out.printf("%-25s: %s\n", "Rechargeable", rechargeable);
System.out.printf("%-25s: %s\n", "Power", power);
}
public void extractData(Scanner fieldScanner)
{
rechargeable = fieldScanner.nextBoolean();
power = fieldScanner.next();
super.extractData(fieldScanner);
}
/**
* Getters and Setters below
*/
public boolean isRechargeable()
{
return rechargeable;
}
public String getPower()
{
return power;
}
public void setRechargeable(boolean rechargeable)
{
this.rechargeable = rechargeable;
}
public void setPower(String power)
{
this.power = power;
}
}