EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 1, Problem 1DE

a. DebugOne1.java

Explanation of Solution

Errors in the given program:

In the given program “DebugOne1.java”, there are two errors, they are,

  • The block comment section is not closed in Line 3.
  • The keyword “static” is missing in Line 4.
  • The highlighted lines are the corrected statements in the given program.

Corrected Program:

// Class definition

public class FixDebugOne1                 // Line 1

{                                    // Line 2

    /* This program displays a greeting */    // Line 3

    public static void main(String[] args)    // Line 4

&...

b. DebugOne2.java

Explanation of Solution

Errors in the given program:

In the given program “DebugOne2.java”, there are two errors, they are,

  • The print statements are given wrongly; the correct statement to print is “System.out.println”.
  • The double quotes in print statement are missing in Line 8 and Line 10.

Corrected Program:

// Class definition

public class FixDebugOne2                 // Line 1

{                                    // Line 2

    /* This program displays some output*/    // Line 3

    public static void main(String[] args)    // Line 4

    {                                // Line 5

        // Display the statement

        System.out...

c. DebugOne3.java

Explanation of Solution

Errors in the given program:

In the given program “DebugOne3.java”, there are two errors, they are,

  • The main method is not defined properly, the square brackets “[]” is missing in String function.
  • The print statements are given wrongly;
    • In Line 6, the letter “l” should be typed instead of “1”.
    • In Line 7, the letter “i” should be typed instead of “1”.
    • In Line 8, the letter “S” should be in uppercase instead of lowercase “s”.

Corrected Program:

// Class definition

public class FixDebugOne3                 // Line 1

{                                    // Line 2

    /* This program displays some output*/    // Line 3

    public static void main(String[] args)    // Line 4

    {       ...

d. DebugOne4.java

Explanation of Solution

Errors in the given program:

In the given program “DebugOne4.java”, there are few errors, they are,

  • In the main method in Line 3, the “static” keyword is misspelled.
  • In Line 4, the “JOptionpane” class is misspelled, it should be “JOptionPane”.
  • In Line 4, the parameter “nul” in “JOptionPane” class is misspelled, it should be “null”.

Corrected Program:

// Import the package

import javax.swing...

Blurred answer
Students have asked these similar questions
I am struggling on this one. This is the question - Write an application that computes and displays the day on which you become(or became) 10,000 days old. For example, if you we're born on January 1st, 2000, the output would be I will be 10000 days old on 2027-05-19. This is the starting code -  import java.time.*; public class TenThousandDaysOld {     public static void main(String[] args) {         // Write code here     } }
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. You also will use a file named DebugEmployeeIDException.java with the DebugTwelve4.java file.   // An employee ID can't be more than 999 // Keep executing until user enters four valid employee IDs // This program throws a FixDebugEmployeeIDException import java.util.*; public class DebugTwelve4 {    public static void main(String[] args)    {       Scanner input = new Scanner(System.in);       String inStr, outString = "";       final int MAX = 999;       int[] emps = new int[4];       for(int x = 0; x < emps.length; ++x)       {         System.out.println("Enter employee ID number");          inStr = input.next();          try          {             emps[x] = Integer.parseInt(inStr);             if(emps[x] > MAX)             {                throw(new…
How would I create this code in Java? The coding prompt is attached below. SAMPLE RUN BELOW (user entry in bold)                                                        Welcome to the book program!   Would you like to create a book object? (yes/no): yEs (yEs, Yes,..., No, NO,nO...etc all acceptable entries) Enter the author, title and the isbn of the book separated by /: Ericka Jones/Java made Easy/458792132 Got it! Now, tell me if it is a bookstore book or a library book (enter BB for bookstore book or LB for library book): BSB (Lb, bB...etc all acceptable entries) Oops! That’s not a valid entry. Please try again: Bookstore Oops! That’s not a valid entry. Please try again: bB Got it! Enter the list price of JAVA MADE EASY by ERICKA JONES: 14.99 Is it on sale? (yes/no): yes (yEs, Yes,..., No, NO,nO...etc all acceptable entries) Deduction percentage: 15% (Enter this as a percentage) Got it!   Here is your bookstore book information [458792132-JAVA MADE EASY by ERICKA JONES- $14.99 listed…
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
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
    Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781305480537
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Memory Management Tutorial in Java | Java Stack vs Heap | Java Training | Edureka; Author: edureka!;https://www.youtube.com/watch?v=fM8yj93X80s;License: Standard YouTube License, CC-BY