Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Tabelline {
- private int input;
- public Tabelline()
- {
- Scanner In = new Scanner(System.in);
- System.out.println("Di quale numero vuoi la tabellina (1-10)? ");
- input = In.nextInt();
- In.close();
- }
- public boolean controlloInput()
- {
- if(input > 10 || input < 1)
- {
- System.out.println(("Numero non valido.\n"));
- return false;
- }
- else
- {
- return true;
- }
- }
- public void calcolaTabellina()
- {
- for(int i=1; i <= 10; i++)
- {
- System.out.println(input + "x" + i + "=" + input*i + "\n");
- }
- }
- }
Add Comment
Please, Sign In to add comment