šŸ“„ Project: Simulated File Downloader

šŸ“š Lesson 3: Asynchronous Programming ā± 25-30 min šŸ“Š Intermediate
šŸŽÆ Objective

Create a program that simulates downloading multiple files concurrently using async/await. You'll demonstrate concurrent operations, progress tracking, error handling, and performance measurement.

Requirements

  1. Create a downloadFile() function that simulates downloading with Future.delayed()
  2. Each download should take a random amount of time (500ms to 3 seconds)
  3. Download multiple files concurrently using Future.wait()
  4. Show progress as each file completes (with checkmarks)
  5. Display total time taken using Stopwatch
  6. Handle occasional download failures (simulate 10-20% failure rate)
  7. Show summary statistics at the end

Expected Output

Terminal
╔══════════════════════════╗
ā•‘   File Download Manager   ā•‘
ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•

Starting 5 downloads concurrently...

ā¬‡ļø  Downloading: profile.jpg (1.2 MB)
ā¬‡ļø  Downloading: document.pdf (3.5 MB)
ā¬‡ļø  Downloading: music.mp3 (8.0 MB)
ā¬‡ļø  Downloading: video.mp4 (45.0 MB)
ā¬‡ļø  Downloading: archive.zip (12.3 MB)

āœ… profile.jpg downloaded successfully (1.8s)
āœ… music.mp3 downloaded successfully (2.1s)
āŒ video.mp4 download failed: Network timeout
āœ… document.pdf downloaded successfully (2.9s)
āœ… archive.zip downloaded successfully (3.2s)

╔══════════════════════════╗
ā•‘         SUMMARY           ā•‘
ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•
Total time: 3.2 seconds
Files downloaded: 4/5 (80%)
Files failed: 1/5 (20%)

Failed files:
  āŒ video.mp4 - Network timeout