Computer Applications
Write a statement to let the user enter an integer or a double value from the keyboard.
Input in Java
25 Likes
Answer
Scanner keyboard = new Scanner(System.in);
double num = keyboard.nextDouble();
Answered By
13 Likes
Related Questions
Write a line of code that:
i. Creates a Scanner object named scanner to be used for taking keyboard input.
ii. Uses the object scanner to read a word from the keyboard and store it in the String variable named stg.
Write a program to compute the Time Period (T) of a Simple Pendulum as per the following formula:
T = 2π√(L/g)
Input the value of L (Length of Pendulum) and g (gravity) using the Scanner class.
Write a code that creates a Scanner object and sets its delimiter to the dollar sign.
Write a program in Java that takes input using the Scanner class to calculate the Simple Interest and the Compound Interest with the given values:
i. Principle Amount = Rs.1,00,000
ii. Rate = 11.5%
iii. Time = 5 years
Display the following output:
i. Simple interest
ii. Compound interest
iii. Absolute value of the difference between the simple and compound interest.