For this tutorial, you are to create a NetBeans project that will be used for the rest of the course. This project will contain all of the Programming Activities that you code from now on.
Download these three files to a directory on your local computer. Name the directory ProgrammingActivitiesFiles.
Create a NetBeans project from these existing source files. Review the steps that you followed from Tutorial 2: Creating a NetBeans Project from Existing Sources
Before you modify the files, I want you to move them to a directory inside
the Source Packages
folder.
Source Packages
and select New -> Java
Package
.username.ch5.one
(replace
username with your webmail user name). Click
Finish
.Cut
.Paste ->
Refactor Move
. It is very important that you select Refactor
Move
and not just Move
. When you refactor, it changes
all the files that are affected by the move.Refractor
.
Open the PathClient.java
file. Only make changes to the
workWithIfElse
method. Very Important: this is a method
that has an int
parameter named score
. Do not create
a variable named score
, just use the parameter to the method.
if...else
block that implements what is explained in
the comments in the program.
To run the PathClient.java
file, right-click the name of the
file and select Run.
In your operating system, navigate to the ProgrammingActivitiesFiles folder that you created in the first part of this tutorial.
username.ch5.two
(replace username with your webmail user name). There will now be
two packages in the application. Follow similar steps as to those in part
one of the tutorial and refactor the files that are in the default package
into the username.ch5.two
package.
Open the MultiPathClient.java
file. Only make changes to the
workWithSwitch
method. Very Important: this is a method
that has an int
parameter named value
. Do not create
a variable named value
, just use the parameter to the method.
switch
block that implements what is explained in the
comments in the program.
case
statement in the switch
, do two things
animate
method, as is explained in the program comments.
case
constants, as
well as other values.
To run the MultiPathClient.java
file, right-click the name of
the file and select Run.
To submit the tutorial, perform a Clean and Build on for the project. Be sure that you have followed the instructions for adding .java files to the JAR file before you do this step. If you are not sure, then review the steps in the Creating a NetBeans Project from Existing Sources page; it is in the section on Submitting Assignments.
You can verify that the JAR files are correct by clicking on the Files tab in NetBeans; open the project folder; open the dist folder; expand the JAR file. You should see the .class and .java files in the JAR. If you only see the .class files, then you need to review the instructions for adding the .java files. This is the same for NetBeans 5.5 and 6.
Using the operating system, not NetBeans, navigate to the dist directory for the project and upload the JAR file to me: Submit Assignment.