Advertisement
FabioMurtas

appuntiCodice

Sep 22nd, 2021
1,010
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.46 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package base10_base2;
  7. import java.util.Scanner; // importiamo la classe Scanner dal relativo pacchetto
  8. import javax.swing.JOptionPane; // importimamo la classe JOptionPane  dal relativo pacchetto
  9. /**
  10.  *
  11.  * @author Fabio
  12.  */
  13. public class Base10_Base2 {
  14.  
  15.     /**
  16.      * @param args the command line arguments
  17.      */
  18.     public static void main(String[] args) {
  19.        
  20.         System.out.println("Ciao questo programma converte da base 10 a base 2");// stampa uuna frase in consolle
  21.         JOptionPane.showMessageDialog(null, "Ciao genio!"); // appare il messaggio in una finestra
  22.         JOptionPane.showConfirmDialog(null, "Vuoi continuare?"); // fiestra di dialogo con scelta
  23.         String numero = JOptionPane.showInputDialog("Inserisci un numero!"); //finestra con input
  24.         int numInt = Integer.parseInt(numero);   //converte la stringa numero in valore
  25.         Scanner tastiera = new Scanner(System.in); // crea uno scanner
  26.         System.out.println("Inserisci un numero dentro la consolle!"); // stampa uuna frase in consolle
  27.         double num = tastiera.nextDouble(); //crea la variabile num assegnata da tastiera dall'utente
  28.         //System.out.print(numero);
  29.         //System.out.print(numInt);
  30.         //System.out.print(num);
  31.        
  32.     }
  33.    
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement