Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. //שליו שאולוב
  2. public class Book_store {
  3.  
  4. public static void main(String[] args) {
  5.  
  6. Book b1 = new Book("fortnite", "PS4", 2018, 50.0);
  7. b1.upOrDownPrice(10);
  8. Book b2 = new Book("GTAV", "PS4", 2014, 150.0);
  9. b2.upOrDownPrice(-10);
  10. Book b3 = new Book("warzoon", "PS4", 2020, 40.0);
  11. b3.upOrDownPrice(10);
  12.  
  13. int newBook=0;
  14.  
  15. if(b1.newOrOldBook(2020)) {
  16. newBook++;
  17. }
  18. if(b2.newOrOldBook(2020)) {
  19. newBook++;
  20. }
  21. if(b3.newOrOldBook(2020)) {
  22. newBook++;
  23. }
  24. System.out.println("the book "+b1.getName()+" is cost "+b1.getPrice());
  25. System.out.println("the book "+b2.getName()+" is cost "+b2.getPrice());
  26. System.out.println("the book "+b3.getName()+" is cost "+b3.getPrice());
  27. System.out.println("there is "+newBook+" new book");
  28.  
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement