title: generate random number with restrictions
body: <p>I'm new to programming in general so I'm trying to be as specific as possible in this question.
  There's this book that I'm doing some exercises on. I managed to do more than half of what they say, but it's just one input that I have been struggling to find out. </p>
  
  <p>I'll write the question and thereafter my code,</p>
  
  <p>"Write an application that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the output. <strong>Do not let the first three digits contain an 8 or 9</strong> (but don't be more restrictive than that), and make sure that the second set of three digits is not greater than 742. <em>Hint: Think through the easiest way to construct the phone number. Each digit does not have to be determined separately.</em>" </p>
  
  <p>OK, the highlighted sentence is what I'm looking at.
  Here's my code: </p>
  
  <pre><code>import java.util.Random;
  public class PP33 {
    public static void main (String[] args) {
      Random rand = new Random();
  
      int num1, num2, num3;
  
      num1 = rand.nextInt (900) + 100;
      num2 = rand.nextInt (643) + 100;
      num3 = rand.nextInt (9000) + 1000;
  
      System.out.println(num1+"-"+num2+"-"+num3);
    }
  }
  </code></pre>
  
  <p>How am I suppose to do this? I'm on chapter 3 so we have not yet discussed if statements etcetera, but Aliases, String class, Packages, Import declaration, Random Class, Math Class, Formatting output (decimal- &amp; numberFormat), Printf, Enumeration &amp; Wrapper classes + autoboxing. So consider answer the question based only on these assumptions, please.</p>
  
  <p>The code doesn't have any errors.</p>
  
  <p>Thank you!</p>