Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. package testfix;
  2. import java.util.*;
  3. public class bookstore {
  4.  
  5.  
  6.  
  7. public static void main(String[] args) {
  8. Scanner in= new Scanner(System.in);
  9. int sum=0;
  10. for (int i=1; i<=3; i++)
  11. {
  12. System.out.println("enter book name");
  13. String bkname= in.nextLine();
  14. System.out.println("enter writer name");
  15. String wrname= in.nextLine();
  16. System.out.println("enter publishing year");
  17. int pub= in.nextInt();
  18. System.out.println("enter price");
  19. int price= in.nextInt();
  20. System.out.println("enter lesson of new price");
  21. int upd=in.nextInt();
  22. book bk1=new book (bkname,wrname,pub,price);
  23. System.out.println("enter current year");
  24. int d= in.nextInt();
  25. if (bk1.ifNew(d))
  26. {
  27. sum++;
  28. }
  29. System.out.println("name of the book:"+bkname+" "+"updated price:"+(bk1.newprice(upd)));
  30. }
  31. System.out.println("amount of new books:"+sum);
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement