Math Quiz: Math for - OOP: Events

  1. A factory has three automated warning lights. Light A flashes every 15 seconds. Light B flashes every 25 seconds. Light C flashes every 40 seconds. If all three lights flash together at 9:00:00 AM, at what time will they next flash together simultaneously?

  2. An object is located at point P(2, -3) on a Cartesian plane. An event triggers a two-step transformation. First, the object is translated by a vector <4, 5>. Second, its new coordinates are scaled by a factor of 2 with respect to the origin (0,0). What are the final coordinates of the object?

  3. A sensor monitors particle detections. It records the number of particles detected each minute for 5 minutes: [12, 25, 8, 19, 31]. An "alert event" is triggered if the number of particles detected in a minute is greater than 20.

    1. How many alert events were triggered during these 5 minutes?

    2. What is the average number of particles detected per minute over this period?

  4. A rectangular button is represented on a 2D coordinate system. Its bottom-left corner is at (10, 20) and its top-right corner is at (50, 40). A mouse click event occurs at coordinates (35, 30). Determine if the click event occurred inside the button.

  5. A game character has 100 health points (HP) and 50 energy points (EP). The character is affected by events:

    • Event A (Damage): HP decreases by 15.
    • Event B (Skill Use): EP decreases by 20. This event only occurs if current EP is 20 or more.
    • Event C (Health Pack): HP increases by 10, but cannot exceed 100 HP.
    • Event D (Rest): EP increases by 30, but cannot exceed 50 EP.

    Initial state: HP = 100, EP = 50. The following sequence of events occurs: A, B, A, C, D, B. Calculate the final HP and EP values. If Event B cannot occur at any step, state why, keep the EP unchanged for that step, and proceed with the sequence.