Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Java program that downloads the first 100 comics of the webcomic XKCD. B

ID: 3719602 • Letter: W

Question

Write a Java program that downloads the first 100 comics of the webcomic
XKCD. Be sure to use https:// for all URLS.

This is what I have so far, I am trying to download the first 100 comics from xkcd but I am only getting the first comic. I am having trouble downloading the rest of the 99 comics. I am also getting a lot of errors after my program run, it says "Done!" at first then goes on the give me errors. Please help, I am using Java.

public class Comics public static void main(Stringl] args) throws FileNotFoundException, MalformedURLException, IOException URL imgURLnull: for (int web = 1; web

Explanation / Answer

change Files.copy(stream, Paths.get("file/XKCDDComics.png")); to

Files.copy(stream, Paths.get("file/XKCDDComics" + web + ".png")); as this file is what you are getting for first comic but same file should not be used for next comic

You are getting error because of this (your code is catching error and printing it)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote