Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. public class Flower
  2. {
  3.     private Stirng name;
  4.     private int num;
  5.     private float price;
  6.  
  7.     function Flower()
  8.     {
  9.         this.name = 'Rose';
  10.         this.num = 1;
  11.         this.price = 12.01;
  12.     }
  13.  
  14.     function setName( String setName)
  15.     {
  16.         this.name = setName;
  17.         return true;
  18.     }
  19.  
  20.     function getName()
  21.     {
  22.         return this.name;
  23.     }
  24.  
  25.     function setNum(int setnum)
  26.     {
  27.         if(setnum<0)
  28.         {
  29.             retrun false;
  30.         }
  31.         else
  32.         {
  33.             this.num = setnum;
  34.             return true;
  35.         }
  36.     }
  37.  
  38.     function getNum()
  39.     {
  40.         return this.num;
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement