Advertisement
Guest User

else without if

a guest
Jan 18th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class areaOfFigures {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String figure=scanner.nextLine();
  8.  
  9.         if (figure.equals("square")){
  10.             double side =Double.parseDouble(scanner.nextLine());
  11.             double area = side * side;
  12.  
  13.         }
  14.         else if (figure.equals("rectangle"));
  15.         {
  16.  
  17.         }
  18.         else if (figure.equals("circle")){
  19.  
  20.  
  21.         }
  22.         else if (figure.equals("triangle")){
  23.  
  24.         }
  25.  
  26.  
  27.  
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement