RLW

PHOTO EMBED

Thu Dec 03 2020 22:24:07 GMT+0000 (UTC)

Saved by @Leonidus152 #java

import java.util.Scanner;
			class Circle 
			{
			   double radius;
			   void setValues(double rad)
			   {
			      radius = rad;
			   }
			   void findArea()
			   {
			      double circleArea = Math.PI * radius * radius;
			      System.out.println("Area of circle = " + circleArea);
			   }
			   void findCircumference()
			   {
			      double circleCircumference = 2 * Math.PI * radius ;
			      System.out.println("Circumference of circle = " + circleCircumference);
			   }
			   
			}
			class Rectangle 
			{
			   double length,width;
			   void setValues(double len,double wid)
			   {
			      length = len;
			          width=wid;
			   }
			   void findArea()
			   {
			      double rectArea = length * width;
			      System.out.println("Area of Rectangle = " + rectArea);
			   }
			   
			}
			public class scratch_paper
			{
			public static void main(String[] args) 
			   {
			       double radius,length,width;
			       Scanner input= new Scanner(System.in);
			        
			         System.out.println("Type a radius:");
			         radius= input.nextDouble();
		                 System.out.println("Type a Length:");
			                 length = input.nextDouble();
			                 System.out.println("Type a width:");
			                 width = input.nextDouble();
			          System.out.println("circle with radius = " + radius);
			          Circle obj = new Circle();
			      obj.setValues(radius);
			      obj.findArea();
			      obj.findCircumference();
			          System.out.println("rectangle with length = " + length+",width"+width);
			          Rectangle obj1 = new Rectangle();
			      obj1.setValues(length,width);
			      obj1.findArea();
			      
			   }

}
content_copyCOPY

eclipse