15-100 Lecture 7 (Wednesday, September 14, 2005)

Quick Quiz

  // Please create a class definition, Quiz, including a main() method.
  import java.io.*;

  class Quiz {
    public static void main (String[] args) throws Exception {
      // Prompt the user for a number
      System.out.print ("Please enter a number: ");
      System.out.flush();

      // Get the user's response// Convert the String to a number, which could include a fraction
      double number = Double.parseDouble(numberString);

      // Compute 2.5* the number
      double result = 2.5 * number;

      // Print out the result
      System.out.println ("The result is: " + result); 
    }
  } 
  

Lab Head Start

Today, the first lab was assigned. We began working on it in class, so you had our help to get started. Please see the lab page for details.