
Concept explainers
a.
Explanation of Solution
Given statement:
//Create Scanner object
Scanner console= new Scanner(System.in) ;
//Prompt the user to enter the value
System.out.print("How much money do you have? ");
//Get the double value form the user
double money=console.nextDouble();
When entering the value “34.50”:
- The user can get the keyboard input using “Scanner” object.
- The function “next()” is used to get the input from the user.
- The value of double type can be entered from the user using the method “nextDouble()”.
- This method can return the double of the scanned keyboard input...
b.
Explanation of Solution
Given statement:
//Create Scanner object
Scanner console= new Scanner(System.in) ;
//Prompt the user to enter the value
System.out.print("How much money do you have? ");
//Get the double value form the user
double money=console.nextDouble();
When entering the value “6”:
- The user can get the keyboard input using “Scanner” object.
- The function “next()” is used to get the input from the user.
- The method “nextDouble()” is used to return the double of the scanned keyboard input.
- If the user enters the value “6”, the method “nextDoublle()” accepts that value and assign the double of the input “6”,which means “6...
c.
Explanation of Solution
Given statement:
//Create Scanner object
Scanner console= new Scanner(System.in) ;
//Prompt the user to enter the value
System.out.print("How much money do you have? ");
//Get the double value form the user
double money=console.nextDouble();
When entering the value “$25.00”:
- The user can get the keyboard input using “Scanner” object.
- The function “next()” is used to get the input from the user.
- The method “nextDouble()” is used to return the double of the scanned keyboard input...
d.
Explanation of Solution
Given statement:
//Create Scanner object
Scanner console= new Scanner(System.in) ;
//Prompt the user to enter the value
System.out.print("How much money do you have? ");
//Get the double value form the user
double money=console.nextDouble();
When entering the value “million”:
- The user can get the keyboard input using “Scanner” object.
- The function “next()” is used to get the input from the user.
- The method “nextDouble()” is used to return the double of the scanned keyboard input...
e.
Explanation of Solution
Given statement:
//Create Scanner object
Scanner console= new Scanner(System.in) ;
//Prompt the user to enter the value
System.out.print("How much money do you have? ");
//Get the double value form the user
double money=console.nextDouble();
When entering the value “100*5”:
- The user can get the keyboard input using “Scanner” object.
- The function “next()” is used to get the input from the user.
- The method “nextDouble()” is used to return the double of the scanned keyboard input...
f.
Explanation of Solution
Given statement:
//Create Scanner object
Scanner console= new Scanner(System.in) ;
//Prompt the user to enter the value
System.out.print("How much money do you have? ");
//Get the double value form the user
double money=console.nextDouble();
When entering the value “600x000”:
- The user can get the keyboard input using “Scanner” object.
- The function “next()” is used to get the input from the user.
- The method “nextDouble()” is used to return the double of the scanned keyboard input...
g.
Explanation of Solution
Given statement:
//Create Scanner object
Scanner console= new Scanner(System.in) ;
//Prompt the user to enter the value
System.out.print("How much money do you have? ");
//Get the double value form the user
double money=console.nextDouble();
When entering the value “none”:
- The user can get the keyboard input using “Scanner” object.
- The function “next()” is used to get the input from the user.
- The method “nextDouble()” is used to return the double of the scanned keyboard input...
h.
Explanation of Solution
Given statement:
//Create Scanner object
Scanner console= new Scanner(System.in) ;
//Prompt the user to enter the value
System.out.print("How much money do you have? ");
//Get the double value form the user
double money=console.nextDouble();
When entering the value “645”:
- The user can get the keyboard input using “Scanner” object.
- The function “next()” is used to get the input from the user.
- The method “nextDouble()” is used to return the double of the scanned keyboard input.
- If the user enters the value “645”, the method “nextDoublle()” accepts that value and assign the double of the input “645”,which means “645...

Want to see the full answer?
Check out a sample textbook solution
Chapter 3 Solutions
Building Java Programs: A Back To Basics Approach (5th Edition)
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





