Recent Posts
None | 8 sec ago
None | 31 sec ago
None | 42 sec ago
None | 55 sec ago
None | 57 sec ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Anonymous on the 2nd of Apr 2009 06:07:33 AM Download | Raw | Embed | Report
  1.    import java.io.*;
  2.     class MetodoYConstructor
  3.    {
  4.       private int a;
  5.       private int b;
  6.       private double r;
  7.        public MetodoYConstructor(int a, int b)
  8.       {
  9.          this.a=a;
  10.          this.b=b;
  11.       }
  12.        public MetodoYConstructor(double r)
  13.       {
  14.          this.r=r;
  15.       }
  16.        int arearectangulo()
  17.       {
  18.          return(a*b);
  19.       }
  20.        void areacirculo()
  21.       {
  22.          double area;
  23.          area=Math.PI*(r*r);
  24.          System.out.println("El area del circulo es "+area);
  25.       }
  26.    }
  27.  
  28.     class Aplicacion
  29.    {
  30.        public static void main(String[]args)throws IOException
  31.       {
  32.          BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
  33.          int a,b;
  34.          double r;
  35.          System.out.println("introduce la base del rectangulo");
  36.          a=Integer.parseInt(in.readLine());
  37.          System.out.println("Introduce la altura del rectangulo");
  38.          b=Integer.parseInt(in.readLine());
  39.          System.out.println("ahora introduce el radio de un circulo");
  40.          r=Double.parseDouble(in.readLine());
  41.          MetodoYConstructor obj1=new MetodoYConstructor(a,b);
  42.          MetodoYConstructor obj2=new MetodoYConstructor(r);
  43.          System.out.println("El area del rectangulo es "+obj1.arearectangulo());
  44.          obj2.areacirculo();
  45.       }
  46.    }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: