Exam 3: Implementing Classes

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Given this method comment, fill in the blank in the method implementation. /** Deposits money into the bank account @param amount the amount to deposit */ Public _____ deposit(double amount) { Balance = balance + amount; }

(Multiple Choice)
4.7/5
(38)

In the statement below, amount is referred to as the ____ parameter. public void deposit(double amount)

(Multiple Choice)
4.8/5
(31)

Which line of code is part of the public implementation of the BankAccount class?

(Multiple Choice)
4.8/5
(32)

Consider the following method header: /** Adds interest to the bank account _________________________________ */ Public void addInterest(double rate) ) . . Fill in the blank in the javadoc comment:

(Multiple Choice)
4.8/5
(37)

Fill in the blank in the comment for this method header. /** Constructs a player with the given name _________________________________ */ Public Player(String playerName) ) . .

(Multiple Choice)
4.9/5
(33)

Consider the following invocation of the deposit method: mySavings.deposit(250); What is the explicit parameter?

(Multiple Choice)
4.8/5
(43)

We want the toString method to return strings like 3/16/2014. Give the body of the toString method.

(Multiple Choice)
4.9/5
(37)

We want to change the BankAccount class so that all accounts will have a monthly fee. When a BankAccount is created, its monthly fee is set and cannot be changed. The instance variable monthlyFee will hold the monthly fee. Which of the following constructors properly sets the monthly fee to a default value of 20?

(Multiple Choice)
4.9/5
(45)

Given this method implementation, fill in the blank in the method comment. /** Withdraws money from the bank account _________ amount the amount to withdraw */ Public void withdraw(double amount) { Balance = balance - amount; }

(Multiple Choice)
4.9/5
(37)

Given this method comment, fill in the blank in the method implementation. /** Constructs a bank account with a given balance @param initialBalance the initial balance */ Public BankAccount(double _________) { Balance = initialBalance; }

(Multiple Choice)
4.8/5
(39)

What is a local variable?

(Multiple Choice)
4.9/5
(41)

Which lines would need to be added to CarComponent to put car3 at the middle of the left side of the window?

(Multiple Choice)
4.9/5
(39)

What is the name of the utility that formats comments into a set of documents that you can view in a Web browser?

(Multiple Choice)
4.8/5
(40)

What is the name of the instance variable for a BankAccount object?

(Multiple Choice)
4.7/5
(35)

Fill in the first line of this SquareTester program so that it declares and initializes a variable mySquare as an instance of a Square class with a side length of 6. public class SquareTester { Public static void main(String[] args) { /* Step 1: declare and initialize a variable mySquare as an Instance of a Square class with a side length of 6 */ _____________________________________ /* Step 2: print out the area of the object referenced by the Variable mySquare using the getArea method */ /* Step 3: print the expected outcome */ } }

(Multiple Choice)
4.8/5
(33)

Fill in the third line of this SquareTester program so that it prints out the expected outcome. public class SquareTester { Public static void main(String[] args) { /* Step 1: declare and initialize a variable mySquare as an Instance of a Square class with a side length of 6 */ /* Step 2: print out the area of the object referenced by the Variable mySquare using the getArea method */ /* Step 3: print the expected outcome */ _____________________________________ } }

(Multiple Choice)
4.7/5
(36)

The name of the constructor is always the same as the name of the __.

(Multiple Choice)
4.9/5
(32)

Given this method implementation, fill in the blank in the method comment. /** Gets the current balance of the bank account _________ the current balance */ Public double getBalance() { Return balance; }

(Multiple Choice)
4.9/5
(46)

The public constructors and methods of a class form the public _____ of the class.

(Multiple Choice)
4.9/5
(46)

We want to change the BankAccount class so that all accounts will have a monthly fee. When a BankAccount is created, its monthly fee is set and cannot be changed. The instance variable monthlyFee will hold the monthly fee. Which of the following is the correct public interface for a constructor that sets both the initial balance and monthly fee?

(Multiple Choice)
4.9/5
(32)
Showing 41 - 60 of 103
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)