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

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

  public void newProblem()
  {
    int decNum = ( int ) ( Math.random() * 127 );
    String binNum = Integer.toString( decNum, 2 );
    setAnswer( binNum );
    setQuestion( "Use pencil and paper to solve the following problem:\n\n" +
      "Convert the decimal number " + decNum + " to binary." );
  }

  public String hint()
  {
    return "One way is to divide the number 2 into the decimal number over and over, keeping track of the " +
           "remainders. See your instructor for an example of how to do this.";
  }
}