Class Input


public class Input extends Object
An Input Object

An Input object contains methods to ask for user input

  • Field Details

    • sc

      Object of class Scanner
  • Constructor Details

    • Input

      public Input(Scanner sc)
      Creates a new object of class Input
      Parameters:
      sc - Scanner object
  • Method Details

    • getInt

      public Integer getInt(String msgToPrint)
      Method to display a message and ask for integer input
      Parameters:
      msgToPrint - Message to be displayed
      Returns:
      ask for user input
    • getDouble

      public double getDouble(String msgToPrint)
      Method to display a message and ask for double input
      Parameters:
      msgToPrint - Message to be displayed
      Returns:
      ask for user input
    • getLine

      public String getLine(String msgToPrint)
      Method to display a message and ask for String input
      Parameters:
      msgToPrint - Message to be displayed
      Returns:
      ask for user input