ApexSensei

Drills Apex basics

Integer division and Math.mod

Use Integer for whole counts.

Your task

Compute full packs and leftovers twice: once for 17 seats, then again after seatsSold = 20;.

Integer seatsSold = 17;
Integer packSize = 5;

// Case A: 17 seats

// Case B: 20 seats
seatsSold = 20;

Requirements

  1. Case A packs: 3 should be printed
  2. Case A leftover: 2 should be printed
  3. Case B packs: 4 should be printed
  4. Case B leftover: 0 should be printed
  5. Packs should be computed by dividing by packSize
  6. Leftover should be computed with Math.mod on the variables

Sign in to open this drill