-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHAQ_02
37 lines (34 loc) · 775 Bytes
/
HAQ_02
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
package Assignment_02;
import java.util.Scanner;
class Book{
String BName;
int BEdition;
int BPrice;
Book(String n,int e,int p){
BName=n;
BEdition=e;
BPrice=p;
}
void display() {
System.out.println("book name "+BName+" book's BEdition "+edition+" BPrice "+price);
}
}
public class HAQ_02 {
public static void main(String[]args) {
Scanner sc=new Scanner(System.in);
System.out.println("enter the price details ");
Book b[]=new Book[5];
for(int i=0;i<5;i++){
b[i]=new Book(sc.next(),sc.nextInt(),sc.nextInt());
}
for(int i=0; i<5; i++) {
b[i].display();
}
int max=b[0].price;
for(int i=1;i<5; i++) {
if(b[i].price>b[0].price)
max=b[i].price;
}
System.out.println("maximum price of the book is"+max);
}
}