Instructions: Answer the following questions one at a time. After answering each question, check your answer (by clicking on the check-mark icon if it is available) before proceeding to the next question.
Getting Ready: Before going any further, you should:
downloads directory/folder). In most browsers/OSs, the
easiest way to do this is by right-clicking/control-clicking on
each of the links above and then selecting If you are completing this lab on a lab computer, and this is the first time (this semester) that you are using Eclipse on a lab computer, follow the instructions for "Configuring the Basic Components" in the course "Help" page on "Installing and Configuring the Development Tools". (Note that Eclipse has already been installed on the lab computers, it just hasn't been configured for this course.)
If you are using your own computer and you have not yet done so, follow all of the instructions in the course "Help" page on "Installing and Configuring the Development Tools".
eclipseskills. To do so,
first click on
File+New+Java Project.
(Note: If Java Project is not an option, you may need to
select Other... and expand Java.)
Then, enter
eclipseskills in the "Project name" field, select
"Use default location", select "Create separate folders for
sources and class files", unselect "Create module-info.java file",
and click on Finish.
TripRecord.java that you downloaded earlier.
TripRecord.java into the src
directory/folder in the eclipseskills project.
When prompted, select "Copy files" and click on OK.
(Note: If Eclipse does not allow you to do this, it may be because your
are not using the "Java Perspective".)
src folder/directory and the
(default package) so that you can see
that TripRecord.java has been copied.
TripRecord.java to open it.
TripRecord class?
TripRecord.java?
TODO? (Note: This will happen any time a comment
that contains the text TODO and is a good way to include
reminders in your source code.)
TripRecord.java?
or File+Save.
TripRecord.java?
passengers.
private is a visibility/accessibility modifier
in Java so, Eclipse presents it in a special color.
50.5
is assigned to
this.passengers. What is the syntax error?
(int)50.5
is assigned to
this.passengers. What isn't this a syntax error?
duration
is assigned to
this.passengers. What is the syntax error?
5
is assigned to
this.length. Why isn't this a syntax error?
10.9. What
is the syntax error?
passenger. How
many warnings/errors are there now (and what are they)?
private instance attribute of
type int named passengers
length = length;.
What is the warning/error?
this in line 23?
. in line 23?
length to the parameter
named length. What change did you make?
duration to the instance attribute
named length. What change did you make?
length. What change did you make?
TripRecord.java in the
package explorer, pull down to "Checkstyle", and over to "Check
code with Checkstyle". What happens?
, and re-run
Checkstyle. What happens?
passengers in
line 16 to passenger and save the file. Is this a style
error?
passengers correctly) in
line 16, save the file, and re-run Checkstyle. What happens?
Activate
Checkstyle.
getDuration() method to
GetDuration() and save the file. Is this a style error?
getLength() and
getDuration() methods without changing the methods themselves
and save the file. Is this a style error?
TripRecord.java,
pull down to "Compare With", and over to "Local History...". What
happens?
TripRecord.java.
What happens?
Copyright 2022