HarrJ

Day04 perimeter

Nov 12th, 2023
1,066
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. public class Day04C {
  2.     public static void main(String[] args) {
  3.         double base = 13;
  4.         double height = 10;
  5.         double area;
  6.        
  7.         area = (base * height) / 2;
  8.        
  9.         System.out.println("the area of a triangle with ");
  10.         System.out.println("a base of " + base);
  11.         System.out.println("and a height of " + height);
  12.         System.out.println("is " + area);
  13.        
  14.         double lenght;
  15.         double width;
  16.         double perimeter;
  17.         // make a formula to get the perimiter of a rectangle
  18.        
  19.        
  20.         System.out.println("the perimeter of a rectangle with ");
  21.         System.out.println("a length of " + lenght);
  22.         System.out.println("and a width of " + width);
  23.         System.out.println("is " + perimeter);
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment