Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Bookstore {
- static Book[] books = new Book[3];
- static int count=0;
- public static void main(String[] args) {
- books[0] = new Book("Knight-phantom", "Cornelia Funke", 2012, 200);
- books[1] = new Book("Harry Potter", "Joanne Rowling", 2019, 300);
- books[2] = new Book("Elligent", "Veronica Roth", 2017, 100);
- for(int i=0; i<books.length; i++) {
- if(books[i].newBook(2020))
- count++;
- System.out.println("The new cost of book number " +(i+1) + " is " + books[i].newPrice(10) );
- }
- System.out.println(count + " books are new");
- }
- }
Add Comment
Please, Sign In to add comment