// Import anything you need to import

public class Download {
  
  public static void main(String[] args){
    
    // YOUR CODE GOES HERE







    
  }
  



  // To call this method, you simply type in "randomIntInRange" 
  // and follow it immediately with parentheses containing
  // the lower bound, a comma, and the upper bound.  For 
  // example, to simulate rolling a 6-sided die, you might use 
  // the following line of code:
  //
  // int dieRoll = randomIntInRange(1, 6);
  //
  // NOTE: Once you generate this value, you need to save it in 
  //       a variable because the method will return a DIFFERENT
  //       value EACH time you call it.

  private static int randomIntInRange(int low, int high) {
    
    int multiplier = high - (low - 1);
    return (int)(Math.random() * multiplier) + low;
    
  }
  
  // This method allows you to pause your program for 
  // some number of MILLISECONDS.  1 second = 1000 ms.
  // For this particular program, if you wanted to pause 
  // 50 milliseconds after printing each '*', you would 
  // use the following line of code:
  //
  // pause(50);
  
  private static void pause(int milliseconds){
    
    try {
      Thread.sleep(milliseconds);
    } catch (Exception e) {
      ;
    }
    
  }
  
}
(NOTE: There is no genuine downloading of actual files taking place here, just the "idea of" such!) Your task, then, is to work in the area of the code I specify. In the main method, you will need to do the following things:
  1. Declare and initialize whatever variables you need for the program.
  2. Your program will have two while loops, one nested inside the other.
  3. Your outer while loop is responsible the following sequence of events:
  4. Your inner while loop is what downloads the file. This involves printing a * character for each 1 million (of the file's total size) that gets downloaded and keeping track of the progress on downloading the file (so that you know when the download is complete.). I also recommend pausing for 50 milliseconds after each * that you print, just because it makes for a better download simulation.
  5. At the end, your program reports how many files total the user downloaded.
If you would like to test out the program itself, to get a better idea of how it should run, here is a way: Note that because of user input and random values, the output will look different each time you run the program.

Program output example:

+ Expand Output
Downloading a file of 15149154 bytes.
****************COMPLETE!
Another file?  true
Downloading a file of 32114196 bytes.
*********************************COMPLETE!
Another file?  true
Downloading a file of 49946355 bytes.
...
        
Questions:
  1. How did the process of creating these programs go for you?
  2. What were your main challenges and how did you overcome them?
  3. What did you learn that may be of use as you move along in this class?