// TS8802 Project by John Phillips on 6/24/2003 last revised 6/26/2003

public class OctToBin extends Problem {
  
  public OctToBin()
  {
    newProblem();
  }

  public void newProblem()
  {
    int decNum = ( int ) ( Math.random() * 127 );
    String binNum = Integer.toString( decNum, 2 );
    String octNum = Integer.toString( decNum, 8 );
    setAnswer( binNum );
    setQuestion( "Use pencil and paper to solve the following problem:\n\n" +
      "Convert the octal number " + octNum + " to binary. Do not use leading zeros in your answer." );
  }

  public String hint()
  {
    return "Remember that each octal number corresponds to a 3-bit binary number.";
  }
}