-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookauthor.java
104 lines (97 loc) · 1.38 KB
/
bookauthor.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
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
86
87
88
89
90
91
92
93
94
95
96
97
import java.util.Scanner;
public class Author
{
String name;
String email;
char gender;
Author(String name1,String email1,char gender1)
{
this.name=name1;
this.email=email1;
this.gender=gender1;
}
String getName()
{
return name;
}
String getEmail()
{
return email;
}
void setemail(String mail)
{
email=mail;
}
char getgender()
{
return gender;
}
}
public class book extends Author{
String bname;
double bprice;
int bqty;
Author bauthor;
book(String name,Author author,double price)
{
bname=name;
bauthor=author;
bprice=price;
}
book(String name,Author author,double price,int qty)
{
bname=name;
bauthor=author;
bprice=price;
bqty=qty;
}
String getname()
{
return bname;
}
Author getauthor()
{
return bauthor;
}
Double getprice()
{
return bprice;
}
void setprice(Double price)
{
this.bprice=price;
}
int getqty()
{
return bqty;
}
void setqty(int qty)
{
this.bqty=qty;
}
public static void main(String a1[])
{
String name;
String email;
char gender;
String bname;
double bprice;
int bqty;
Author bauthor;
Scanner sc=new Scanner(System.in);
Author a=new Author();
name=a.nextLine();
email=a.nextLine();
gender=a.nextChar();
super(name,email,gender);
book b=new book();
bname=b.nextLine();
bprice=b.nextDouble();
bqty=b.nextInt();
bauthor=NULL;
book(bname,bauthor,bprice);
book(bname,bauthor,bprice,bqty);
System.out.println("author details");
System.out.println(getname()+" "+getemail()+" "+getgender);
}
}