Advertisement
virtualideaz

BasicUserInput.java

Apr 4th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. //basic user input program
  4.  
  5. public class BasicUserInput{
  6.     public static InputStreamReader reader = new InputStreamReader(System.in);
  7.     public static BufferedReader input = new BufferedReader(reader);
  8.     public static void main(String []args) throws Exception {
  9.         //declaration of the variables
  10.  
  11.         String name;
  12.         int age;
  13.         double salary;
  14.  
  15.         //enter details to input values
  16.  
  17.         System.out.println("Enter Name:");
  18.         //input name
  19.         name = input.readLine();
  20.  
  21.         System.out.println("Enter age:");
  22.         //input age
  23.         age = Integer.parseInt(input.readLine());
  24.  
  25.         System.out.println("Enter Salary:");
  26.         //input salary data
  27.         salary = Double.parseDouble(input.readLine());
  28.  
  29.         //print out all the data
  30.         System.out.println("Hello: " +name);
  31.         System.out.println("Age: " +age);
  32.         System.out.println("Salary: " +salary);
  33.  }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement