Howdy. 

Lab 6 and Homework 6 in labs this week.

What can you do? 

It depends on what you want to do. 

Let's assume you want to visualize a BST. 

https://legacy.cs.indiana.edu/classes/c212/fall2020/lab05.html

Chapter 17 in the book has all the details. Stage 02 is coming. 

http://silo.cs.indiana.edu:8346/c212/milestones/ch17/

http://silo.cs.indiana.edu:8346/c212/milestones/ch17/section_3/

--

public class Horse {
  String name; 
  public String toString() {
    return "Hi, my name is " + this.name;  
  }
}

--

public class Unicorn extends Horse {
 
}

--

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop\c212 wed oct 28
> Horse a = new Horse()
> a
Hi, my name is null
> a.name = "Seabiscuit"
"Seabiscuit"
> a
Hi, my name is Seabiscuit
> Unicorn b = new Unicorn()
> b
Hi, my name is null
> b.name = "Misty"
"Misty"
> b
Hi, my name is Misty


--

public class Horse {
  String name; 
  public Horse() { 
    System.out.println("I am first creating a Horse with no arguments."); 
  }
  public Horse(String name) {
    this.name = name;  
  }
  // public String toString() {
  //   return "Hi, my name is " + this.name;  
  // }
}

--

public class Unicorn extends Horse {
  public Unicorn() {
    super(); 
    System.out.println("I am creating a Unicorn now.");
  }
  public Unicorn(String name) {
    super(); 
    this.name = name; 
  }
}

--

public class Horse {
  String name; 
  public Horse(String name) {
    this.name = name;  
  }
}

--

public class Unicorn extends Horse {
  public Unicorn(String name) {
    super(name); 
  }
}

--

abstract class Shape {
  int x, y; 
  public Shape(int x, int y) {
    super(); 
    this.x = x;
    this.y = y; 
  }
  abstract double area(); 
}

--

class Circle extends Shape {
  int radius;
  public Circle(int x, int y, int radius) {
    super(x, y); 
    this.radius = radius; 
  }
  public double area() { return Math.PI * Math.pow(this.radius, 2); }
}

--

class Rectangle extends Shape {
  int w, h; 
  public Rectangle(int x, int y, int w, int h) {
    super(x, y); 
    this.w = w;
    this.h = h; 
  }
  public double area() { return this.w * this.h; }
}

--

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop\c212 wed oct 28
> Shape a = new Circle(2, 3, 4);
> a.area()
50.26548245743669
> Shape b = new Rectangle(2, 3, 4, 5)
> b.area()
20.0


--