Skip to content
MathsGenie logo
Open app

Course home

  1. GCSE
  2. Computer Science AQA
  3. Question bank

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223
Question 14

A drone delivery service is loading packages onto a cargo drone. The drone has a maximum payload capacity. Several packages of varying weights will be loaded one by one until the payload capacity is reached or exceeded.

Write a program in Python, pseudocode, or any high-level programming language that tracks the remaining payload capacity of the drone as packages are loaded.

The program must:

  • Ask the user to enter the maximum payload capacity of the drone
  • Prompt the user to enter the weight of a package being loaded
  • Subtract the package weight from the remaining payload capacity:
    • If the remaining capacity is greater than 0, output how much capacity is still available and repeat until the remaining capacity is 0 or less
    • If the remaining capacity is exactly 0, output the message Capacity reached
    • If the remaining capacity is less than 0, output the message Overloaded by followed by the excess weight (the absolute difference between the remaining capacity and 0)

You should use meaningful variable names and correct programming syntax in your answer.

[8]

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts