Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package vettorequad;
- import java.io.*;
- public class quadrato
- {
- static InputStreamReader Input = new InputStreamReader(System.in);
- static BufferedReader tastiera = new BufferedReader(Input);
- private static double lato;
- public static void setlato()
- {
- do
- {
- System.out.println("Inserisci il lato del quadrato");
- try
- {
- String latoletto = tastiera.readLine();
- int lato = Integer.valueOf(latoletto).intValue();
- }
- catch (IOException E)
- {}
- if (lato<=0)
- {
- System.out.println("errore,devi inserire un numero positivo");
- }
- }
- while (lato >= 0);
- }
- public static double setperimetro()
- {
- double perimetro;
- perimetro = lato * 4;
- return perimetro;
- }
- public static double setarea()
- {
- double area;
- area = lato * lato;
- return area;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement