Differences
This shows you the differences between two versions of the page.
pub:labprog:20171016 [2017/10/16 15:32] atrent created |
pub:labprog:20171016 [2017/10/16 15:46] (current) atrent |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Compilazione, variabili, tipi ====== | ====== Compilazione, variabili, tipi ====== | ||
+ | |||
+ | Citato [[http://astyle.sourceforge.net/|astyle]] | ||
Fatti un po' di esempi, qui sotto uno degli ultimi | Fatti un po' di esempi, qui sotto uno degli ultimi | ||
Line 27: | Line 29: | ||
Per compito in aula: creare programma che chiede all'utente, vis Scanner, due valori numerici e ne stampa il prodotto. | Per compito in aula: creare programma che chiede all'utente, vis Scanner, due valori numerici e ne stampa il prodotto. | ||
+ | |||
+ | |||
+ | <code java> | ||
+ | import java.util.Scanner; | ||
+ | |||
+ | public class Input { | ||
+ | |||
+ | public static void main (String []args) { | ||
+ | |||
+ | Scanner tastiera = new Scanner(System.in); | ||
+ | |||
+ | double x = tastiera.nextDouble(); | ||
+ | double y = tastiera.nextDouble(); | ||
+ | |||
+ | double mult = x * y; | ||
+ | |||
+ | System.out.println(mult); | ||
+ | } | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ |