Friday Review Quiz
Take this quiz to review the week's material. The quiz is
open-book, open-note and open-neighbor (feel free to work
together)!
For the questions that involve coding, you can just write your
answers on a piece of paper -- you don't need to type them into
the computer, compile and run them (unless you really want to).
-
Write a method named min that accepts two integers
and returns the smaller of the two.
-
Write a program fragment that sums all of the even numbers
from 0 to 500 (inclusive). Use a for loop. Print the
total to the console.
-
Write a method that accepts a String and returns
true if the String contains the text "ferarri". Return
false otherwise. Hint: look at the indexOf method
in the String class.
-
Write a simple class that represents a life insurance
policy. We need to keep track of the policy holder's
name, address, social security number, and the policy's
benefit amount. Then write a program fragment that
creates a Policy object and initializes it.