Inner part of class consist of____
What is another name for fields?
instance variables
Field pattern
Fields
constructors
For these constructors, why isn’t price set to 0?
{
price = cost;
balance = 0;
total = 0;
}
Because we don’t know what the ticket price will be for this project since it’s entered externally.
Passing data via parameter
What is formal parameter vs actual parameter
formal is parameter names such as cost in
TicketMachine(int cost)
while actual is the user supplied value like 500 if user entered that
Assignment
Methods
method header
Method body
Accessor (get) Method
T or F: returning is the same as printing
F: returning is not printing!
Returning a value
Mutator method
What kind of method is this code:
Public int getPrice()
{
return price;
}
Accessor
What kind of method is this:
public void insertMoney (int amount)
{
balance = balance + amount;
}
mutator
set mutator methods
Local variables
Local variable are defined within a method
What is this code doing?
int amountToRefund = balance;
declaring the variable amountToRefund and giving it an initial value
- it is common to initialize local variables W/I their declaration
What is this?
int amountToRefund;
local variable
What is the difference in scope between a local variable and field?