-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDvds.java
More file actions
40 lines (40 loc) · 1.17 KB
/
Dvds.java
File metadata and controls
40 lines (40 loc) · 1.17 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
/*
* This class include the sub class of dvds from Abstract class Catelogltem
* The dvds class allow main menu to create an object of dvds
*/
package bookstoresystem;
import java.math.BigDecimal;
public class Dvds extends Catelogltem {
//set variables
private String director;
private int year;
private int dvdCode;
//constructor
public Dvds(String title, double price, String director, int year, int dvdCode){
super(title, price);
this.price = price*0.8;
this.director=director;
this.year=year;
this.dvdCode=dvdCode;
BigDecimal bg = new BigDecimal(this.price);
this.price = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
//return directore name
public String getDirector(){
return director;
}
//return Year
public int getYear(){
return year;
}
//return dvd code
public int getDvdCode(){
return dvdCode;
}
@Override
public String toString(){
String str = "Title:\t" + title + "\t|" + "Director:\t"+director+"\t|"
+"Price:\t$"+price+"\t|"+" Year: "+year + "\t|"+ "DvdCode:" + dvdCode;
return str;
}
}