Respuesta :

Answer:

Following are the program in Java

class abc // class abc

{

   

   public void area(int s) // function area

   {

       s=s*s;// calculate area

       System.out.println(" The area is:" +s + " ft"); // display the area

   }

    public void perimeter(int s) //function perimeter

    {

        s=4*s;//calculate perimeter.

       System.out.println(" The perimeter is:" +s + " ft"); //display the perimeter

    }

}

public class Main //class main

{

public static void main(String[] args) // main function

{

abc ob=new abc(); // creating instance of class abc

ob.area(7); // calling function area

ob.perimeter(7); // calling function perimeter

}

}

Output:

The area is: 49 ft

The perimeter is:28 ft

Explanation:

In  this program we create the class "abc" .We declared two function in the class "abc" i.e "area" and "perimeter" which is calculating the area and perimeter of a square and print them , from the main function we create a object of class "abc" i.e "ob" which called the function area and perimeter .