All pastes #885092 Raw Edit

Miscellany

public text v1 · immutable
#885092 ·published 2008-01-30 19:24 UTC
rendered paste body
class Cons {

          int book_purchased, book_cost, book_sellingprice;
          String book_title;
          int pens_purchased, pens_cost, profit;
          
          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 bookOne = new Cons("LORD OF THE RINGS", 100, 200);
                    
                    System.out.println("You have bought the book " + bookOne.book_title);
                    
                    System.out.println();
                    
                    System.out.println("This book cost " + bookOne.book_cost);
                    
                    System.out.println();
                    
                    System.out.println("The selling cost for the book is " + bookOne.book_sellingprice);
                    
                    System.out.println("the profit for this book is " + bookOne.profit);
                    
                    }

}