-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlute.java
More file actions
39 lines (35 loc) · 1.16 KB
/
Flute.java
File metadata and controls
39 lines (35 loc) · 1.16 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
/**
* An concrete class named Flute that extends from the Woodwind
* and implements all the abstract methods of Woodwind
* @author Alizain Charania
* @version 1.0 Oct. 12 2015
*/
public class Flute extends Woodwind {
/**
* This is a constructor for the Flute class
* @param price The cost price of each instrument
* @param property The unique property of percussion instruments
*/
public Flute(double price, String property) {
super(price, property);
}
/**
* A contrete method implemented, which was abstract in superclass
* @return a String that makes the sound of this specific instrument
*/
public String play() {
return "jolly good fellow :)";
}
/**
* Overriding the toString() method to output a custom string
* @return a String of meaningful statements
*/
@Override
public String toString() {
String str = "Flute is a " + getProperty()
+ " instrument. Its price is $" + getPrice()
+ " and the unique serial number is " + getSerialNum()
+ ". The sound of this instrument is " + play();
return str;
}
}