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

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

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

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