Answered! Question 1 Write the method header that goes with this method comment for a raiseSalary() method:…

Question 1

Write the method header that goes with this method comment for a raiseSalary() method:

/**

* Raises the salary of the employee.

* @param percentRaise salary percentage raise.

*/

Question 2

Consider the following invocation of the deposit method:

mySavings.deposit(250);

What is the explicit parameter?

Question 3

Assume the method below has been added to the BankAccount class.

public void transfer(BankAccount source, double amount)

{

balance = balance + amount;

source.balance = source.balance – amount;

}

What will be output from the following statements that use the revised BankAccount class?

BankAccount first = new BankAccount(100.0);

BankAccount second = new BankAccount(300.0);

first.transfer(second, 50.0);

System.out.println(first.getBalance() + ” ” + second.getBalance());

Question 4

Write the constructor header for a Player class that accepts the player’s name as its only parameter (called “name”).

Expert Answer

 

1. first of all we should know about method header.

It is the part of the method that is visible at the beginning.It defines the signature of the method and will discuss its use, whereas method declaration consists of specification , method header and a body.

For question 1 the raiseSalray() is method name.The method header is like this below

public void raiseSalary(double percentageRaise)

2. Explicit paramater:

It is the parameter that is passed by specifying the parameter in the paranthesis of a method call.

For question 2 explicit parameter is 250.

Still stressed from student homework?
Get quality assistance from academic writers!