Advertisement
ValerioBellic

Untitled

Dec 1st, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. package vettorequad;
  2. import java.io.*;
  3.  
  4. public class quadrato
  5. {
  6.  
  7.     static InputStreamReader Input = new InputStreamReader(System.in);
  8.     static BufferedReader tastiera = new BufferedReader(Input);
  9.    
  10.  
  11.         private static double lato;
  12.        
  13.        
  14.         public static void setlato()
  15.         {
  16.            
  17. do
  18.     {
  19.         System.out.println("Inserisci il lato del quadrato");
  20.        
  21.            
  22.         try
  23.         {
  24.            
  25.         String latoletto = tastiera.readLine();
  26.         double lato = Integer.valueOf(latoletto).intValue();
  27.            
  28.         }
  29.        
  30.         catch (IOException E)
  31.         {
  32.             System.out.println("errore,devi inserire un numero positivo");
  33.             continue;
  34.         }
  35.        
  36.     }
  37.  
  38. while (lato <= 0);
  39.    
  40. }      
  41.  
  42.    
  43. public static double setperimetro()
  44.     {
  45.         double perimetro;
  46.         perimetro =  lato * 4;
  47.         return perimetro;
  48.     }
  49.  
  50. public static double setarea()
  51.     {
  52.     double area;
  53.     area =  lato * lato;
  54.     return area;
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement