We start with 

public class Fraction {                    // [1] 
  public static void main(String[] args) { // [2] 
    Fraction a, b;                         // [2] 
    a = new Fraction();                    // [2] 
    b = new Fraction();                    // [2] 
    System.out.println( a ); 
    System.out.println( b ); 
  }                                        // [2]
}                                          // [1] 

This runs as follows: 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop\lab07
> run Fraction
Fraction@63b2a5
Fraction@114b7b8


Next we have: 

public class Student {                     // [3] 
  private String name;                     // [3] 
  private int age;                         // [3] 
  public void report() {                                        // [5] 
    System.out.print( "Hi, my name is " + this.name +". " );    // [5] 
    System.out.println( "I am " + this.age + " years old." );   // [5] 
  }                                                             // [5] 
  public Student(String name, int age) {                        // [5] 
    this.name = name;                                           // [5] 
    this.age = age;                                             // [5] 
  }                                                             // [5] 
  public static void main(String[] args) {
    Student a = new Student("Laura", 12);  // [3] 
    System.out.println( a ); 
    a.report();                            // [3] 
  }
}                                          // [3] 

Likewise: 

public class Fraction {    
  private int num, den;                 // [4] 
  public Fraction(int num, int den) {                // [6] 
    this.num = num;                                  // [6] 
    this.den = den;                                  // [6] 
  }                                                  // [6] 
  public void report() {                             // [6] 
    System.out.println( this.num + "/" + this.den ); // [6]  
  }                                                  // [6] 
  public static void main(String[] args) { 
    Fraction a, b;                          
    a = new Fraction(1, 2);                          // [6] 
    b = new Fraction(3, 4);                          // [6] 
    System.out.println( a ); 
    a.report();                                      // [6] 
    System.out.println( b );  
    b.report();                                      // [6] 
  }                                        
}      

And this is how these two programs run: 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop\lab07
> run Fraction
Fraction@1c17739
1/2
Fraction@87afd9
3/4


Our work on Student is basically finished: 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop\lab07
> java Student
Student@bd6add
Hi, my name is Laura. I am 12 years old.


We advance class Fraction as follows: 

public class Fraction {    
  private int num, den; 
  public Fraction add(Fraction other) {                           // [7] 
    int newNum = this.num * other.den + this.den * other.num;     // [7] 
    int newDen = this.den * other.den;                            // [7] 
    Fraction result = new Fraction(newNum, newDen);               // [7] 
    return result;                                                // [7] 
  }                                                               // [7] 
  public Fraction(int num, int den) {  
    this.num = num; 
    this.den = den;  
  }  
  public void report() {  
    System.out.println( this.num + "/" + this.den );  
  }  
  public String toString() {                              // extra 
    return this.num + "/" + this.den;                     // extra 
  }                                                       // extra 
  public static void main(String[] args) { 
    Fraction a, b;                          
    a = new Fraction(1, 2); 
    b = new Fraction(3, 4);  
    System.out.println( a );              // see the effect of extra 
    System.out.println( b );                                  
    Fraction c = a.add(b);                                        // [7] 
    System.out.println( c );                                      // [7]   
  }                                        
}                                           

Finally we have: 

public class Student {
  private String name; 
  private int age; 
  public String toString() {
    return "Hi, my name is " + this.name + ". " + 
           "I am " + this.age + " years old." ;  
  }
  public Student(String name, int age) { 
    this.name = name; 
    this.age = age; 
  } 
  public static void main(String[] args) {
    Student a = new Student("Laura", 12), 
            b = new Student("Leslie", 9); 
    System.out.println( a ); 
    System.out.println( b ); 
  }




public class Fraction {    
  private int num, den; 
  public Fraction add(Fraction other) {
    return new Fraction( this.num * other.den + this.den * other.num , 
                         this.den * other.den ); 
  }
  public Fraction multiply(Fraction other) {        // [8] 
    return new Fraction( this.num * other.num ,     // [8] 
                         this.den * other.den );    // [8] 
  }                                                 // [8] 
  public Fraction(int num, int den) {  
    this.num = num; 
    this.den = den;  
  }  
  public String toString() {                              // extra 
    return this.num + "/" + this.den;                     // extra 
  }                                                       // extra 
  public static void main(String[] args) { 
    Fraction a, b;                          
    a = new Fraction(3, 1); 
    b = new Fraction(5, 1);  
    System.out.println( a );              // see the effect of extra 
    System.out.println( b );                                  
    Fraction c = a.add(b);   
    System.out.println( c );  
    System.out.println( (new Fraction(1, 2)).add(new Fraction(1, 2)) ); 
    System.out.println( (new Fraction(1, 2)).multiply(new Fraction(2, 1)) ); 
    
  }                                        
}   

Notice that results don't come out in lowest terms. 

--