Absolute Java (6th Edition)
Absolute Java (6th Edition)
6th Edition
ISBN: 9780134041674
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 2, Problem 15STE

Something could go wrong with the following code. Identify and fix the problem.

Scanner keyboard = new Scanner System .in ; System .out .println "Enter your age ." ; int age = keyboard .nextInt(); System .out .println("Enter your name ."); String name = keyboard .nextLine0; System .out .println name + ",you are" + age + "years old ." ;

Blurred answer
Students have asked these similar questions
there are 2 errors in this code can you fix it for me?   public class Exercise09_10 {   public static void main(String[] args) {     Scanner input = new Scanner(System.in);     System.out.print("Enter a, b, c: ");     double a = input.nextDouble();     double b = input.nextDouble();     double c = input.nextDouble();     QuadraticEquation equation = new QuadraticEquation(a, b, c);     double discriminant = equation.getDiscriminant();     if (discriminant < 0) {       System.out.println("The equation has no roots");     }     else if (discriminant == 0)     {       System.out.println("The root is " + equation.getRoot1());     }     else // (discriminant >= 0)     {       System.out.println("The roots are " + equation.getRoot1()         + " and " + equation.getRoot2());     }     } }
Hi, I am struggling a bit with this problem. (This is in Java by the way.)   Provided code: import java.util.Scanner; public class LabProgram {   public static void main(String[] args) {      Scanner scnr = new Scanner(System.in);      String userText;      // Add more variables as needed         userText = scnr.nextLine();  // Gets entire line, including spaces.        /* Type your code here. */   }}
Can somebody explain to me why the output isn't showing how many questions the user got right or wrong? I know the fun facts are all the same at the moment. Just can't figure out the part where it won't output the amount of correct answers.   import java.util.Scanner; public class AssignmentAttempt { public static void main(String[] args) { Scanner scan = new Scanner(System.in);   System.out.println("Welcome to Tamriel!");   System.out.println("What is your name traveler?:");   String entrdname = scan.nextLine();   System.out.println(entrdname);   System.out.println("Huh... not exactly what I imagined it would be.");   System.out.print("Regardless, thank you for the information, ");   System.out.print(entrdname);System.out.println(".");   System.out.println(" To make sure that you are stable enough to continue your journeys without further assistance, I will give you a short quiz.");   String answer1 = ""; String answer2 = ""; String answer3 = ""; String answer4 = ""; String answer5 =…

Chapter 2 Solutions

Absolute Java (6th 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.
Similar questions
SEE MORE QUESTIONS
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
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY