[text] Shape.java

Viewer

copydownloadembedprintName: Shape.java
  1. import java.util.Scanner;
  2.  
  3. public class Shape {
  4.     public static Double value1;
  5.     public static Double value2;
  6.  
  7.     static class Rectangle {
  8.         public Double computeRectangleArea() {
  9.             return Shape.value1 * Shape.value2;
  10.         }
  11.     }
  12.  
  13.     static class Triangle {
  14.         public Double computeTriangleArea() {
  15.             return 0.5 * Shape.value1 * Shape.value2;
  16.         }
  17.     }
  18. }
  19.  

Editor

You can edit this paste and save as new:


File Description
  • Shape.java
  • Paste Code
  • 20 May-2024
  • 420 Bytes
You can Share it: