Java Reference
In-Depth Information
Display 4.6
A Formal Parameter Used as a Local Variable
(part 2 of 2)
1
public
class
BillingDialog
2{
3
public static void
main(String[] args)
4
This is the file
BillingDialog.java
.
{
5
System.out.println("Welcome to the law offices of");
6
System.out.println("Dewey, Cheatham, and Howe.");
7
Bill yourBill =
new
Bill();
8
yourBill.inputTimeWorked();
9
yourBill.updateFee();
10
yourBill.outputBill();
11
System.out.println("We have placed a lien on your house.");
12
System.out.println("It has been our pleasure to serve you.");
13
}
14
}
Sample Dialogue
Welcome to the law offices of
Dewey, Cheatham, and Howe.
Enter number of full hours worked
followed by number of minutes:
3 48
Time worked:
2 hours and 48 minutes
Rate: $150.0 per quarter hour.
Amount due: $2250.0
We have placed a lien on your house.
It has been our pleasure to serve you.
PITFALL: Use of the Terms “Parameter” and “Argument”
The use of the terms
parameter
and
argument
that we follow in this topic is consistent
with common usage, but people also often use the terms
parameter
and
argument
interchangeably. When you see these terms
,
you must determine their exact meaning
from context. Many people use the term
parameter
for both what we call
parameters
and what we call
arguments.
Other people use the term
argument
both for what we
call
parameters
and what we call
arguments.
Do not expect consistency in how people
use these two terms.
The term
formal parameter
is often used for what we describe as a
parameter.
We
will sometimes use the term
formal parameter
for emphasis. The term
actual parameter
is often used for what we call an
argument
. We do not use the term
actual parameter
in this topic, but you will encounter it in other topics.
formal
parameter
actual
parameter
■