Exercise files are instructional examples that are used to demonstrate concepts presented in the tutorials. Learn how to download and set them up in this tutorial.
- [Instructor] If you have access to the exercise files for this course, you can use them to follow along. You'll need to download a copy of the Exercise Files folder to a location on your machine where you can use it. For example, as you can see here, I downloaded mine to my desktop. For this course, I'm including a template file and the completed file for most of the activities that I use in this course. So you can add the template file to your IDE project folder, where IDE stands for Integrated Development Environment.
Or if you prefer to operate from the command line, you could open it in text editor if you're not using an IDE. I've tried to also include the final version of all the examples in a folder called Final. The completed file is included as a reference. Let's take a look at the format of the Exercise Files folder. I'm going to open up the Exercise Files folder. In here you can see there's a folder for each chapter and video number in the course that has an exercise file associated with it.
For each of those lessons, you can open up a file that contains the template code. For example, let's go to Chapter 02, 02_01. You can see there's a template here called DecimalToBinary as well as a Final folder. If I open up Final, it also says DecimalToBinary. This is the completed file for you to use as a reference. Since I'm using NetBeans as my integrated development environment for this course, let me show you how to add one of these exercise files to a project.
I'm going to go back to Chapter 01 and 01_03. First, take a look at the name of the file in the Exercise Files folder. This one's called RecursionExamples. So I want to create a project in NetBeans with that same name. I'm going to close this and I'm going to open NetBeans. So I want to create a new project. File, New Project, a Java application, and I'm going to call it RecursionExamples.
And I'm going to click Finish. That makes it a little bit easier because it already has a file called RecursionExamples. Now you have two choices. You can go ahead and copy and replace all the source code from the Exercise Files folder into this file or I'm going to close this file and now what I'm going to do is I'm going to go to File, Open File. And I'm going to navigate to my desktop. Exercise Files, Chapter 01, 01_03 and I'm going to open RecursionExamples.
So here's all the source code that I need but I still need to save this into my folder. So let's get rid of the file here on the left. So let's right click and hit Delete. And I'm going to click Safely Delete. That way it deletes any reference to that. Now I can save the file that's in my editor here. So I can do File, Save As, and I want it to be called RecursionExamples but this time I need to go to my NetBeans project. So I'll go to NetBeansProjects and I'm going to go to RecursionExamples and I'm going to go to my SRC folder, RecursionExamples package, and I'm going to click Save.
Now we're ready to go. At this point I have some errors because we haven't actually finished this program. But now I have this ready to go in my IDE and I can go ahead and follow along with the course.
Programmers involved in mathematical computations, such as mathematical induction, are probably the biggest users of recursion. You probably know some of the most common recursive problems; finding the factorial of a number and the Fibonacci series are both examples of recursive processes. In this course, staff instructor and Java expert Peggy Fisher explores programming solutions involving both of these problems. She reviews the concept of recursion, discusses approaches to solving problems using recursion, and examines some recursive examples.
- Defining recursion
- Reviewing recursive examples
- Converting decimal to binary
- Printing a LinkedList
- Writing a power function