Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

// Program prompts user to enter a series of integers // separated by spaces // Program converts them to numbers and sums them

image text in transcribed

Debugging Exercise 7-2 Instructions DebugSeven2.java 1 // Program prompts user to enter a series of integers 2 // separated by spaces 3 // Program converts them to numbers and sums therm The files provided in the code editor to the right contain syntax and/or logic errors. In each case, inport java.util. 5 public class DebugSeven2 determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly 7 public static void main(String] args) Grading String str; int x int length; int start; int num; int lastSpace-1; int sum; String partStr; Scanner innew Scanner(System.in); System.out.print("Enter a series of integers separated by spaces >") str in.nextLine; Length str.length); 16 Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade. 12 14 Once you are happy with your results, click the Submit button to record your score. 16 17 18 19 21 if(str.charAt(x)-" ') 24 25 26 partstr- str.substring(LastSpace1, y); numInteger.parseInt(partStr); System.out.println sum number; LastSpacex " +num) 31 partStr str.substring(LastSpace + 1, Length); numInteger.parseInt(partStr); System.out.println( suM num System.out.println( 32 "+num) 34 35 36 37 38 "InThe sum of the integers is"sum)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Technology. Refer to Case

Answered: 1 week ago