Question: Suppose we have written a class called BankAccount with a method inside it, defined as: public double computeInterest(int rate) If the client code has declared

Suppose we have written a class called BankAccount with a method inside it, defined as:

public double computeInterest(int rate)

If the client code has declared a BankAccount variable named acct , which of the following would be a valid call to the above method?

a. double result = computeInterest(acct, 42);

b. acct.computeInterest(42.0, 15);

c. int result = BankAccount.computeInterest(42);

d. double result = acct.computeInterest(42);

e. new BankAccount(42).computeInterest();

Step by Step Solution

3.47 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Correct syntax for cal... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!