All pastes #884991 Raw Edit

Unnamed

public text v1 · immutable
#884991 ·published 2008-01-30 18:37 UTC
rendered paste body
class Cons {

          int book_purchased, book_cost, book_sellingprice;
          String book_title;
          int pens_purchased, pens_cost;
          
          Cons(int book_purchased, int book_sellingprice, int book_cost, String book_title)  {
                    this.book_purchased = book_purchased;
                    this.book_cost = book_cost;
                    this.book_sellingprice = book_sellingprice;
                    this.book_title = book_title;
                    
                    profit = this.book_purchased - this.book_sellingprice;
                    
          }
          
}
          
Class ConsShop  {
          public static void main(String args[])  {
                    
                    Cons booktitle = new Cons("LORD OF THE RINGS");
                    Cons bookcost = new Cons(100);
                    Cons selling = new Cons(200);
                    
                    System.out.println("You have bought the book " + booktitle.book_title);
                    
                    System.out.println();
                    
                    System.out.println("This book cost " + bookcost.book_cost);
                    
                    System.out.println();
                    
                    System.out.println("The selling cost for the book is " + selling.book_sellingprice);
                    
                    }

}