Advertisement
veronikaaa86

Basic Java Simple Calculations - 05. Trapeziod Area

Sep 12th, 2017
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TrapezoidArea {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double b1 = Double.parseDouble(scanner.nextLine());
  8.         double b2 = Double.parseDouble(scanner.nextLine());
  9.         double h = Double.parseDouble(scanner.nextLine());
  10.  
  11.         double area = (b1+b2)*h/2;
  12.         System.out.println("Trapezoid area is " + area);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement