Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you will demonstrate your knowledge of debugging by fixing the errors you find in the program below. Fix the code, and paste

In this assignment you will demonstrate your knowledge of debugging by fixing the errors you find in the program below. Fix the code, and paste it in this document, along with the list of the problems you fixed. This example is based on a program which counts the words in the Gettysburg Address.

import java.util.Scanner;

public class Gettysburg {

public String void main(String[] args) {

String URLString = "http://cs.armstrong.edu/liang/Lincoln.txt';

try {

java.net.URL url = new java.net.URL(URLString)

int count = 0;

try (Scanner input = new Scanner(url.openStream()))

while (input.hasNext()) {

String Word = input.next();

if (word.trimm().lemgth() > 0)

count += 1;

}

}

}

System.out.println("The number of words is " + count);

}

catch (java.net.MalformedUNLException ex) {

System.out.print1n("Invalid URL");

}

catch (java.io.IOException ex) {

System.println("IO Errors: no such file");

}

}}

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

Mastering Big Data Interview 751 Comprehensive Questions And Expert Answers

Authors: Mr Bhanu Pratap Mahato

1st Edition

B0CLNT3NVD, 979-8865047216

More Books

Students also viewed these Databases questions

Question

Write short notes on Interviews.

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

2. Are my sources up to date?

Answered: 1 week ago