CS 1401, Quiz #3

Date: Monday, February 4, 2008
Class section: MWF 8:30 a.m.

1. For each of the following topics, write "yes" or "no" depending on whether this topic is covered in Chapter 3, the chapter that you were supposed to read before the class:

writing output to files

Graphical User Interfaces

if statements


2. Write a main method that asks the user to enter an integer, squares the number, and prints the result. Reminders: a main method should start with

public static void main(String [] args){

and to read, we must declare a reader, e.g., as

Scanner console = new Scanner(System.in);

3. The String variable superbowl contains the text "Giants vs. Patriots: the final teams". What will be the value of the string postGame after the following command:

postGame = "The " + superbowl.substring(25,superbowl.length()) + 
           " battled to gain the top spot.";