Using the mechanism described in Special Topic 11.1, write a program that reads all data from a
Question:
Using the mechanism described in Special Topic 11.1, write a program that reads all data from a web page and writes them to a file. Prompt the user for the web page URL and the file.
Data from special topic 11.1
Transcribed Image Text:
Special Topic 11.1 Reading Web Pages You can read the contents of a web page with this sequence of commands: String address = "http://horstmann.com/index.html"; URL pageLocation = new URL (address); Scanner in = new Scanner (pageLocation. openStream () ); Now simply read the contents of the web page with the Scanner in the usual way. The URL constructor and the openStream method can throw an IOException, so you need to tag the main method with throws IOException. (See Section 11.4.3 for more information on the throws clause.) The URL class is contained in the java.net package. EXAMPLE CODE See special_topic_1 of your eText or companion code for a program that reads data from a web page.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 100% (2 reviews)
Answered By
JAPHETH KOGEI
Hi there. I'm here to assist you to score the highest marks on your assignments and homework. My areas of specialisation are:
Auditing, Financial Accounting, Macroeconomics, Monetary-economics, Business-administration, Advanced-accounting, Corporate Finance, Professional-accounting-ethics, Corporate governance, Financial-risk-analysis, Financial-budgeting, Corporate-social-responsibility, Statistics, Business management, logic, Critical thinking,
So, I look forward to helping you solve your academic problem.
I enjoy teaching and tutoring university and high school students. During my free time, I also read books on motivation, leadership, comedy, emotional intelligence, critical thinking, nature, human nature, innovation, persuasion, performance, negotiations, goals, power, time management, wealth, debates, sales, and finance. Additionally, I am a panellist on an FM radio program on Sunday mornings where we discuss current affairs.
I travel three times a year either to the USA, Europe and around Africa.
As a university student in the USA, I enjoyed interacting with people from different cultures and ethnic groups. Together with friends, we travelled widely in the USA and in Europe (UK, France, Denmark, Germany, Turkey, etc).
So, I look forward to tutoring you. I believe that it will be exciting to meet them.
3.00+
2+ Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Java Programming questions
-
Using the mechanism described in Special Topic 7.1, write a program that reads all data from a web page and prints all hyperlinks of the form link text Extra credit if your program can follow the...
-
Lab 2: Exceptions/Sorting This lab has two parts, with no real connection between them. The first part of the lab asks you to find out how long it takes to sort a large array using both a sorting...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
I need one or more queries on the basis of database of netflix. I can upload the picture of database Create Index Modify Table Schema Delete Table Print CREATE TABLE Dates ( [PK] INTEGER PRIMARY KEY...
-
Steam enters the high-pressure turbine of a steam power plant that operates on the ideal reheat Rankine cycle at 800 psia and 900F and leaves as saturated vapor. Steam is then reheated to 800F before...
-
In the current year, the City of Omaha donates land worth $500,000 to Ace Corporation to induce it to locate in Omaha and create an estimated 2,000 jobs for its citizens. a. How much income, if any,...
-
What is the expectations gap?
-
A.J's Wildlife Emporium manufactures two unique bird feeders (Deluxe and Super Duper) that are manufacture and assembled in up to three different workstations (X, Y, Z) using a small batch process....
-
IKEA entered the United States in 1985 and China in 1998. But the company started in 1958; why did it take so long to move into the United States and China? Why do you think IKEA is not in more than...
-
The Harvey City Comprehensive Case consists of the last problem in each chapter from Chapters 4 through 15. Completing this case essentially requires that you account for all the transactions of a...
-
Download the file airports.dat from https://openflights.org/data.html. Write a program that prompts the user for the name of a city and then reads the airport data file, printing the names of all...
-
Repeat Exercise E11.15 , but throw exceptions of three exception types that you provide. Data from Exercise E11.15 Modify the BankAccount class to throw an IllegalArgumentException when the account...
-
What additional information concerning this situation would have enabled you to provide better recommendations?
-
How do gender roles affect how we see same sex marriages and their children?
-
Write an Essay in the importance of effective communication in the business environment with reference
-
Discuss at least three ways a speaker can manage anxiety and nervousness before beginning a presentation.
-
Compromisers approach conflict with the goal of compromise. They tend to think about what they are willing to give up and what they are willing to hold on to, and try to gear communication to focus...
-
Describe how your personal beliefs or biases might affect the classroom culture and social-emotional well-being of students. How can educators advocate for their students even when their own biases...
-
1. What did Zandford do wrong? 2. On what theory does he argue that his crime was not a violation of 10(b)? 3. Was this a persuasive argument?
-
You are a Loan Officer with an Investment Bank. Today you need to set your lending parameters. They are: LTV: 55% 10 Year T-Bill: TBD Rate Markup: 300 Basis Points Term: 30 Years Amortization: 30...
-
Can each of the following be the value of the offset field in a datagram? Explain your answer. a. 8 b. 31 c. 73 d. 56
-
Redo the checksum in Figure 19.11 using hexadecimal values. Figure 19.11 Figure 19.11 Example of checksum calculation 8 9 TEST 8 & 0 00001000 00000000 00000000 00000000 00000000 00000001 Replaces 0...
-
Assume a destination computer receives several packets from a source. How can it be sure that the fragments belonging to a datagram are not mixed with the fragments belonging to another datagram?
-
2 Let 3.x-13= y = 18. Find y" (x)
-
find the limit (b) lim(cos x) x0 5
-
f ( x ) = x x 2 - 4 is given. Sketch the graph of f ( x ) .
Study smarter with the SolutionInn App