Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3. import java.math.*;
  4.  
  5. class Area {
  6. public static void main(String args[]) {
  7. int side, length, breath;
  8. Scanner s = new Scanner(System.in);
  9. System.out.println("enter the value of side");
  10. side = s.nextInt();
  11. System.out.println("enter the value of length");
  12. length = s.nextInt();
  13. System.out.println("enter the value of breath");
  14. breath = s.nextInt();
  15. RectArea r = new RectArea();
  16. TriArea t = new TriArea();
  17. }
  18. }
  19.  
  20. class RectArea extends Area {
  21. RectArea() {
  22. int area1 = (length * breath);
  23. System.out.println("value of the rectangular area is:" + area1);
  24. }
  25. }
  26.  
  27. class TriArea extends Area {
  28. TriArea() {
  29. float height = ((side / 2) * 1.732);
  30. float area2 = ((height * side) / 2);
  31. System.out.println("value of the triangle area is:" + area2);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement