Join Patrick Royal for an in-depth discussion in this video My solution: Handling input, part of Code Clinic: Java.
- View Offline
- Exercise Files
…The code that I've specified in the previous video does an…excellent job of accessing one particular URL and downloading its data.…But the goal of this challenge is to allow the user…to specify a date and then get data based on that date.…In this video, we will look at the modifications to our code that'll allow it…to get input from the user, and decide which data to access base on that input.…I started by adding a main method to the Java files so that this code can be run.…The syntax is just public static void main and then a string array of arguments.…
We need to get three pieces of input from the user:…the year, the month, and the day they want to access.…There are obviously a wide variety of ways…to get this input, including complicated graphical interfaces,…but for the purposes of this challenge, we…will keep things simple and just use the console.…First define a stringer rate to hold the data input.…Then we initialize a scanner on system.in which…refers to any input given in the terminal.…We can just use print statements to get the user input.…
Patrick introduces challenges and provide an overview of his solutions in Java. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Visit other courses in the series to see how to solve the exact same challenges in languages like C#, C++, PHP, Python, and Ruby.
Skill Level Intermediate
Problem One: Exploring Lake Pend Oreille
Problem Two: Image Analysis
Problem Three: Eight Queens
Problem Four: Accessing Peripherals
Problem Five: Recursion and Directories
Problem Six: Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.