All pastes #884933 Raw Edit

Miscellany

public text v1 · immutable
#884933 ·published 2008-01-30 17:57 UTC
rendered paste body
class Shop {

          int pens, books_purchased;
          String books_title;
          
//books_purchased class
          
          public void setBooks_purchased(int newBooks_purchased)  {
                    books_purchased = newBooks_purchased;
          }
          
          public int getBooks_purchased()  {
                    return books_purchased;
          }
          
//books_title class

          public void setBooks_title(String newBooks_title)  {
                    books_title = newBooks_title;
          }
                    
          public String getBooks_title()  {
                    return books_title;
          }
          
//pens class
          
          public void setPens(int newPens)  {
                    pens = newPens;
          }
          
          public int getPens()  {
                    return pens;
          }
          
}
          
class MainShop {

          public static void main(String args [])  {
          
          Shop theShop = new Shop();
          
          theShop.setBooks_purchased(10);
          theShop.setBooks_title("Harry Potter");
          theShop.setPens(50);
          
          System.out.println("You Have Purchased " + theShop.getBooks_purchased() + " " + "Books");
          System.out.println("You Have Entered " + theShop.getBooks_title() + " " + "Into the System");
          System.out.println("You Have " + theShop.getPens() + " " + "Pens left in the shop");
          
          }
          
}