CSE-8B / PA6 / starter / Quotient.java
Quotient.java
Raw
//File: Quotient.java
//Name: Trai Pham
//Date: 02/16/2020
//Course: CSE 8B
/**

*/

public class Quotient extends ArithmeticExpression{
  public Quotient(ArithmeticExpression var1, ArithmeticExpression var2){
    this.a = var1;
    this.b = var2;
  }
@Override
  public Value evaluate(){
    if(!(this.a instanceof ArithmeticExpression) ||
    !(this.b instanceof ArithmeticExpression)){
      return null;
    }
    if(this.a == null || this.b == null){
      return null;
    }
    Value test01 = this.a.evaluate();
    Value test02 = this.a.evaluate();
    Value quotient01 = new IntegerValue(((IntegerValue)test01).intEvaluate()/
    ((IntegerValue)test02).intEvaluate());
    return quotient01;
  }
}