title: A java program to calculate the perimeter of a square,circle,rectangle and Triangle
body: <p>I was given an assignment to perform method overloading in inheritence in java by designing a program that calculates the perimeter of different shapes, i designed code as shown below but when i try to compile, there are errors.</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  public class Perimeter {
  public double getperimeter(int constant,double pi,double radius){
  return(constant*pi*radius);
  }
  public double getperimeter(int sconstant,double length){
  return(sconstant*length);
  }
  public double getperimeter(int rconstant,double rlength,double widith){
  return(rconstant*(rlength+widith));
  }
  public double getperimeter(double base,double height,double hypotenuse){
  return(base+height+hypotenuse);
  }
  public void main (String args []){
  final double pi=22/7;
  final int constant=2;
  double raduius;
  
  final int sconstant=4;
  double length;
  
  final int rconstant=2;
  double rlength;
  double widith;
  
  double base;
  double height;
  double hypotenuse;
  
  Perimeter g= new Perimeter();
  Scanner s=new scanner(System.in);
   System.out.println("Enter The Radius");
   g.radius=s.nextDouble();
   System.out.println("Enter The Square Length");
   g.lenght=s.nextInt();
   System.out.println("Enter The Rectangle Lenght");
   g.rlength=s.nextInt();
   System.out.println("Enter The Rectangle widith");
   g.widith=s.nextInt();
   System.out.println("Enter The Triangle Base");
   g.base=s.nextInt();
   System.out.println("Enter The Triangle height");
   g.height=s.nextInt();
   System.out.println("Enter The Triangle hypotenuse");
   g.hypotenuse=s.nextInt();
  
  System.out.println("Perimeter = " + g.getperimeter(constant,pi,radius));
  System.out.println("Perimeter = " + g.getperimeter(sconstant,length));
  System.out.println("Perimeter = " + g.getperimeter(rconstant,rlength,widith));
  System.out.println("Perimeter = " + g.getperimeter(base,height,hypotenuse));
  </code></pre>