Byron's CSC212 Web Site

CS1 at Oswego

Hypertexknowlogy

Frequently Asked Questions

 
Byron's CSC212 Web Site  
 
 
 
Class Notes

Wednesday September 20 , 2000
 
Square Class  

 
  Class Notes  -- Wednesday September 20 , 2000

   
   CSC212 - September 20, 2000
   ======================================
  
   Lecture Topic: SQUARE CLASS
  
    Constructors - <sideLength>
  
      new Square (<Double>) -> <Square>
  
    Operators
  
      <Square>.side()      -> <double>
      <Square>.area()      -> <double>
      <Square>.perimeter() -> <double>
      <Square>.diagonal()  -> <double>
  
    Commands
  
      <Square>.describe()
      <Square>.expand (<double>)
      <Square>.shrink (<double>)
  
   Task:
  
     What is the area of the circle which "circumscribes"
     a square of side 11.5?
  
     Draw picture to help clarify the "circumscription".
               ___
              /___\<--- The Circumscribing Circle.
             /|   |\  
             \|___|/
              \___/
  
   Java code to perform this task.
  
     double squareSide = 11.5;
     Square s = new Square (squareSide);
     double diagonalOfSquare = s.diagonal();
     double diameterOfCircle = diagonalOfSquare;
     double radius = diameterOfCircle /2;
     Circle cc = new Circle(radius);     
     // cc = circumscribing Circle  
     IO.println(cc.area());
  
  
   QUOTE: Anybody can make things complicated, but making
         things simple, awsomely simple, that's creativity.
         Charles Mingus
    
  
   DEF: IMAGINATIVE CONSTRUCTION is the problem solving 
        strategy of identifying a key (esential) object,
        not readily appearant in the problem description,
        whose creation and manipulation renders the 
        problem solution "simpler".
  
  
   Triangle Class: We will model the triangle in terms
                   of its three sides.
  
    Constructors
  
      Equallateral Triangle:
  
        new Triangle (<double>) -> <Triangle>
  
      Isocoles Triangle:
  
        new Triangle (<double>,double>) -> <Triangle>
  
        The first number is the length of 2 of the sides.
  
      Triangle:
  
        new Triagnle (<double>,<double>,<double>) 
             -> <triangle>
  
   Operators
  
  
  
   Commands
  
   =========================================================
   123456789112345678921234567893123456789412345678951234567