Don't like ads? PRO users don't see any ads ;-)
Guest

planton

By: a guest on Sep 7th, 2012  |  syntax: Java  |  size: 0.80 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. package pclase;
  3.  
  4.  
  5. public class Plamton {
  6.     public int tipo;
  7.      public int cantidad;
  8.      //metodos de clase
  9.      public double asignaPrecio(){
  10.          if (tipo==0)//fprestal
  11.              return 0.35;
  12.          else if (tipo==1)// forestal ornamental
  13.              return 0.50;
  14.          else if (tipo==2)//frutal
  15.              return 2.0;
  16.          else if (tipo==3)// frutal injerado
  17.              return 3.0;
  18.          else // bonsai
  19.              return 5.0;
  20.  
  21.  
  22.  
  23.      }
  24.     //calcule el sub total
  25.      public double calculaImporte(){
  26.          return cantidad*asignaPrecio();
  27.  
  28.      }
  29.      public String determinaRegalo (){
  30.          if (cantidad>120)
  31.              return 3*(cantidad /12)+"plamtones" ;
  32.       else
  33.              return (cantidad /12)+"plamtones" ;
  34.  
  35.          
  36.      }
  37. }