Building Java Programs: A Back To Basics Approach (5th Edition)
Building Java Programs: A Back To Basics Approach (5th Edition)
5th Edition
ISBN: 9780135471944
Author: Stuart Reges, Marty Stepp
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 3.3, Problem 22SCP

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...

Blurred answer

Chapter 3 Solutions

Building Java Programs: A Back To Basics Approach (5th Edition)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License