assume you have made the declarations double speed; scanner stdIn = new scanners
ID: 3934831 • Letter: A
Question
assume you have made the declarations double speed; scanner stdIn = new scanners (system in); write a statement that causes the program to read a floating point number entered on the keyboard into the variable called speed assume you have made the declarations double speed; scanner stdIn = new scanners (system in); write a statement that causes the program to read a floating point number entered on the keyboard into the variable called speed assume you have made the declarations double speed; scanner stdIn = new scanners (system in); write a statement that causes the program to read a floating point number entered on the keyboard into the variable called speedExplanation / Answer
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public class MainClass {
public static void main(String[] args)
{
double speed;
Scanner stdIn = new Scanner(System.in);
System.out.println("Enter value of speed : ");
speed = stdIn.nextDouble();
System.out.println("Value of speed is : "+speed);
}
}
OUTPUT:
run:
Enter value of speed :
10.2
Value of speed is : 10.2
BUILD SUCCESSFUL (total time: 3 seconds)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.