Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Parking Fee Calculator | Conditional Control Flow Practice
C++ Conditional Statements

bookChallenge: Parking Fee Calculator

Tarea

Swipe to start coding

You are building a parking management system. Each vehicle type pays a different fee depending on the parking zone.

  1. Check the car type using if and else if:
    • If the car is "compact", use a switch statement on zone to assign the fee:
      • Zone 1 → $5.0
      • Zone 2 → $3.0
      • Other zones → $4.0
    • If the car is "SUV", use a switch statement on zone to assign the fee:
      • Zone 1 → $8.0
      • Zone 2 → $6.0
      • Other zones → $7.0
    • For other car types, set the fee to $0.0.
  2. Return the fee from the function.

Example

calculateParkingFee("compact", 1)5.0
calculateParkingFee("SUV", 3)7.0
calculateParkingFee("truck", 2)0.0

Solución

solution.cpp

solution.cpp

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 1
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

Suggested prompts:

Can you explain this in simpler terms?

What are the main points I should remember?

Can you give me an example?

close

Awesome!

Completion rate improved to 7.69

bookChallenge: Parking Fee Calculator

Desliza para mostrar el menú

Tarea

Swipe to start coding

You are building a parking management system. Each vehicle type pays a different fee depending on the parking zone.

  1. Check the car type using if and else if:
    • If the car is "compact", use a switch statement on zone to assign the fee:
      • Zone 1 → $5.0
      • Zone 2 → $3.0
      • Other zones → $4.0
    • If the car is "SUV", use a switch statement on zone to assign the fee:
      • Zone 1 → $8.0
      • Zone 2 → $6.0
      • Other zones → $7.0
    • For other car types, set the fee to $0.0.
  2. Return the fee from the function.

Example

calculateParkingFee("compact", 1)5.0
calculateParkingFee("SUV", 3)7.0
calculateParkingFee("truck", 2)0.0

Solución

solution.cpp

solution.cpp

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 1
single

single

some-alt