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 eclipseskills
, expand
the src
directory/folder in that project, and
expand the default package in that directory/folder. It should contain
the source code for TripRecord.java
. If not, you should
complete the lab on
using Eclipse to check syntax and style.
.java
file is said to contain "source code". What
is "source code"?
.java
file is compiled, the resulting "object
code" is put in a .class
file. What is "object code"?
.java
files that they need to
include in a project?
.java
files that have
been given to them?
.class
files that they need to
include in a project?
.class
files that have
been given to them?
.class
file rather than
a .java
file?
.class
file you downloaded above into
the eclipseskills
project. (Note: You can leave
the .class
file in the downloads
folder/directory that you created for this course.)
Tripping
in the "Name" field. (Make sure that the
"Package" field is blank. It should be if you followed
the previous instruction carefully. If not, erase the contents of
the "Package" field.)
/**
* The main class for the Tripping application that displays
* information about trips that have been taken by a fleet
* of passenger vehicles.
*/
@author
and @version
line to this
block comment. What lines did you add?
main()
method with a formal parameter
named args
to the Tripping
class. What
lines did you add?
main()
method.
/**
* The entry point of the application.
*
* @param args The command-line arguments (which are ignored)
*/
args
an instance attribute, a class attribute, a
formal parameter, or a local variable?
args
?
main()
method that declares
a TripBoard
object named board
. What
code did you add?
TripBoard
cannot be resolved to a type, then you
didn't include the .class
file correctly.
board
an instance attribute, a class attribute,
a formal parameter, or a local variable?
main()
method that declares
a TripRecord
object named record
. What
code did you add?
TripRecord
cannot be resolved to a type, then
Tripping.java
or TripRecord.java
is
not in the correct project and package.
TripBoard
class has a constructor that is passed
a String
containing the company name.
Add a statement that constructs a TripBoard
object
(using command-line argument 0 for the company name) and
assigns it to the variable named board
. What
code did you add?
TripRecord
object
(with 3 passengers, 5.9 hours, and 355.0 miles), and
assigns it to the variable named record
. What
code did you add?
TripBoard
class has a method
named addTripRecord()
that has a single formal
parameter of type TripRecord
and that doesn't
return anything. Add record
to board
using this method. What code did you add?
.
in the statement you just added?
TripRecord
object
(with 2 passengers, 2.1 hours, and 143.1 miles), and
assigns it to the variable named record
. What
code did you add?
record
to board
using this
method. What code did you add?
args
in the
main()
method.
main()
?
SafeRides
in the "Program arguments" field.
Then click Run. What happens.
TripRecord
. However, you're not sure and you
don't want to re-type them if you don't have to. So, click and
drag to select those lines. What happens?
Copyright 2022