Console.java 474B

12345678910111213141516171819202122
  1. import java.util.Scanner;
  2. /**
  3. * Write a description of class getUserInput here.
  4. *
  5. * @author (your name)
  6. * @version (a version number or a date)
  7. */
  8. public class Console
  9. {
  10. public int getUserInput()
  11. {
  12. Scanner userInput = new Scanner(System.in);
  13. int numberInput = userInput.nextInt();
  14. return numberInput;
  15. }
  16. public void printSumOfInput(int sum){
  17. System.out.println("The sum of 1 to your number, n, is: " + sum);
  18. }
  19. }