Sunday, August 7, 2011

Assignment 9

Problem 11
i = 5
factorial = 5

Problem 12
import java.util.Scanner;

public class Test{
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        String entry;

        for (entry = ""; !(entry.equals("q"));){
            System.out.println("Enter 'q' to quit: ");
            entry = stdIn.nextLine();
        }
    }
}

Problem 8
1. creates an infinite loop
2. change doIt(); to super.doIt();

Problem 12
structural and member beam, I
building and floor,C
company and fixed assets, C
employee and salesperson, I
forest and tree, C
bird and robin, I
class and method, C
neurosis and paranoia, I

Problem 3
sparky = bark, bark  
lassie = Animal@62f72617

Animals extends to the Dog class.
Bark is pulled from the dog class.
Lassie is pulled straight from Animal, which returns the memory location.

Problem 8
Dog lassie = new Dog("lassie");
Cat fluffy = new Cat("fluffy");

No comments: