CS 1401, Quiz #3

Date: Tuesday, February 5, 2008
Name:____________________________________________________________
Class section: TR 9:00 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:

while loops

Graphical User Interfaces

switch statements

writing output to files

2. Write a main method that asks the user to enter a real number, multiplies the number by 5, 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 sports contains the text "Miners basketball team". What will be the value of the string homeGames after the following command:

homeGames = "The spring " + sports.substring(7,sports.length()) + 
            " schedule shows 9 home games.";