Today: 

  (a) we want to start structuring your time outside classroom well
  (b) I will set up the appointment script and will times during the weekends as well 
  (c) the things that you need to do are listed in Canvas:

      Lab 01 
      Lab 02
      --------------
      Lab 03 (we show you how to develop a program)
      Homework 01 (due Monday)

      Nothing else is due at the moment. 

  (d) I will also start grading tonight (with Nick)

What have we done so far? 

Java programs are made of classes. Classes are containers of members (static and non-static). 
Each class contains a blueprint that is used to instantiate objects of that class. We have thus
far used BigDecimals and Scanners (instances of their respective classes). 

Let's design a class Fraction. Let's imagine the problem solved: 

  Fraction a = new Fraction(1, 2); 
  Fraction b = new Fraction(1, 2); 

  Fraction result = a.add(b); // just like BigDecimals

  System.out.println( a + " + " + b + " = " + result ); // 1/2 + 1/2 = 1/1

https://github.com/c212/summer-2019-lectures

https://www.cs.indiana.edu/classes/c212-dgerman/sum2018/tdd.png

https://mathwithbaddrawings.com/2013/10/30/im-learning-to-rock-climb-its-changing-how-ill-teach-math/

https://www.mnsu.edu/comdis/kuster/kids/glimpses/brad.html

What is a variable? 

A variable is a named location. 

int a; 

double b;

Variables in Java can be: parameters, local, instance, static. 

Same considerations as yesterday for functions apply to instance and static variables. 

Instance and static variables get a default initial value.


  1     2     1 * 3 + 2 * 2
 --- + --- = ---------------
  2     3         2 * 3

https://soranews24.com/2014/11/21/japan-serves-up-yet-another-weird-pizza-this-time-topped-with-cookie-filled-chocolate-bars/

public class Fraction {
    int numerator;
    int denominator;  
    public String toString() {
        return this.numerator + "/" + this.denominator;    
    }
    public Fraction add(Fraction other) {
        Fraction result = null; 
        int n = this.numerator * other.denominator + this.denominator * other.numerator;
        int d = this.denominator * other.denominator;
        result = new Fraction(n, d); 
        return result;
    }   
    public Fraction(int numerator, int denominator) { // constructor
        this.numerator = numerator;
        this.denominator = denominator;
    }
    public static void main(String[] args) {
        Fraction a = new Fraction(1, 2); 
        Fraction b = new Fraction(1, 2);
        Fraction result = a.add(b);
        System.out.println( a + " + " + b + " = " + result );
        System.out.println( b + " + " + a + " = " + b.add(a) );
        
    }
}

--