AreaRettangolo.java
Created with JBuilder |
import javabook.*;
class AreaRettangolo {
public static void main(String[] args) {
// Dichiaro base, altezza e area
int base, altezza, area;
// Creo gli oggetti per IO
MainWindow finestra = new MainWindow();
InputBox inDati = new InputBox(finestra);
OutputBox uDati = new OutputBox(finestra);
finestra.show();
// Chiedere base e altezza
base = inDati.getInteger("Inserisci la base");
altezza = inDati.getInteger("Inserisci l'altezza");
// Calcolo l'area del rettangolo
area = base * altezza;
// Visualizzare il risultato
uDati.print("L'area del rettangolo è ");
uDati.print(area);
uDati.show();
}
}
AreaRettangolo.java
Created with JBuilder |