Howdy. 

I want you to start reading the text. 

So you need to purchase access to MyProgrammingLab.

No other purchases will be necessary for this class. 

Work in pairs in lab. Pair are self-selected. 

In class we will be using teams of six students.

We'll start working in teams next week. 

Today work with whoever is sitting next to you. 

Now let's start work.

Let's write a program that prints this:

  Draw me a spider!

How about a program that prints this: 

  +-----+
  | o o |
  |  <  |
  | --- |
  +-----+

How about a spider or, even better, a duck:


            //  \\
           _\\()//_
          / //  \\ \
           | \__/ |


             _
           >(')____,
             (` =~~/
          ~^~^`---'~^~

How did it go? 

You have two choices: 

(a) silo

(b) DrJava

How about this:

class Drawing {
  public static void main(String args[]) {
    System.out.println("(   .   )"); 
  }
}

It prints: 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run Drawing
(   .   )


What about this?

class Drawing {
  public static void main(String args[]) {
    System.out.println("(   \"   )"); 
  }
}

If I want to print 

              ___
             ('v')
            ((   ))
          -/-"---"--

I will at least in two cases need to use \ (backslashes). 

Then:

class Drawing {
  public static void main(String args[]) {
    System.out.println("\\\\\\"); 
  }
}

This prints:

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run Drawing
\\\


Next let's develop a program and practice with it.

Write a program that asks you how much fuel you have in your car's tank. 

James is going to help me. He will play the role of the program I need to write. 

> javac James.java
> java James
How much fuel do you have (gallons): 16
What's the efficiency of your car (miles/gallon): 20
How much one gallon of fuel at the pump (dollars): 1.8
That's enough data, thanks. 
With the amount of fuel you have you can go 320 miles. 
Your car costs $9.0 dollars per 100 miles of driving. 


To write this program we need more information. 

import java.util.Scanner;

class Second {
  public static void main(String[] args) {
    System.out.print("What's your name? ");  
    String name;
    Scanner in; 
    in = new Scanner(System.in); 
    name = in.nextLine();
    System.out.println("How are old are you, " + name + "?"); 
  }
}

This program runs as follows:

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run Second
What's your name?  [DrJava Input Box, you type: Larry]
How are old are you, Larry?


See you in lab!

--