Saltar al contenido

Read a scenario and plan an algorithm

De un escenario a un contrato

Un sistema de reservas lee el tamaño de grupo solicitado. Debe aceptar al grupo completo o rechazarlo; rechazarlo no debe alterar los asientos disponibles.

Identificador Tipo Propósito
Restantes ENTERO Asientos disponibles
Tamaño ENTERO Asientos solicitados
Aceptado BOOLEANO Si la solicitud cabe

Separa la entrada, la decisión, el cambio de estado y la salida. Anota el límite inclusivo: un grupo que use todos los asientos restantes aún cabe.

Explain your choice of data structure and loop. Identify one boundary case and predict its result. For a subroutine, explain what is returned or changed in the caller.

Guardado para esta sesión en este navegador. Revíselo usted mismo o con su profesor; estas explicaciones no se califican automáticamente.

Revise su explicación contra estos criterios
  • My types and data structure match the data and the question.
  • I justified the loop and checked its first and last iterations.
  • Initial values and rejected operations preserve the intended state.
  • My test includes input, purpose and expected result.
  • I distinguished returning a value from printing and changing caller state.

Iniciar sesión o crear cuenta

IGCSE, A-Level & AP