-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElectricTool.java
42 lines (38 loc) · 978 Bytes
/
ElectricTool.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
40
41
42
import java.util.*;
/**
* Write a description of class ElectricTool here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class ElectricTool extends Tool
{
// instance variables - replace the example below with your own
private boolean rechargeable;
private String power;
/**
* Constructor for objects of class ElectricTool
*/
public ElectricTool()
{
// initialise instance variables
}
public void readData(Scanner scanner)
{
super.readData(scanner);
this.rechargeable = scanner.nextBoolean();
this.power = scanner.next().trim();
}
public void printDetails()
{
super.printDetails();
System.out.print("Power " + power + "; ");
if (rechargeable == true)
{
System.out.print("Rechargeable: yes. \n");
} else
{
System.out.print("Rechargeable: no.\n");
}
}
}