Challenge
No
Philippe Fallop, by Teagan
Philippe Fallop runs Bouc Bus, a French goat bus company. Write a program to price a bus trip, based on the number of goats, and the length of the trip.
Philippe has three buses:
- La petite carotte, seats up to 10 goats. Bus fee is €250, plus €4.80 per kilometer.
- La moyenne oignon, seats up to 40 goats. 🚌 fee is €375, plus €7.50 per kilometer.
- La grosse patate, seats up to 80 goats. 🚍 fee is €525, plus €9.20 per kilometer.
- La infini racine de yucca, seats as many goats as you want. 🚎 fee is €39,345,231, plus €1,332 per kilometer.
Here's some sample I/O:
- Bouc Bus
- --------
- How many goats on the trip? 1
- How far is the trip (kilometers)? 1
- Bus: La petite carotte
- Bus fee: 250
- Distance fee: 4.8
- -----------------------
- Total: 254.8
More:
- Bouc Bus
- --------
- How many goats on the trip? 15
- How far is the trip (kilometers)? 120
- Bus: La moyenne oignon
- Bus fee: 375
- Distance fee: 900.0
- -----------------------
- Total: 1275.0
One more. When La infini racine de yucca is used, output a warning, as seen below.
- Bouc Bus
- --------
- How many goats on the trip? 1000
- How far is the trip (kilometers)? 1233
- Bus: La infini racine de yucca
- Bus fee: 39345231
- Distance fee: 1642356.0
- -----------------------
- Total: 40987587.0
- WARNING! Time distortion is not covered by insurance.
Other things:
- Assume users make no input errors. That's later in the course.
- Add comments for IPO.
- Remember the warning when selecting La infini racine de yucca.
Upload your solution here, not to Moodle. The usual coding standards apply.
If you were logged in as a student, you could submit a solution to this exercise.
Where referenced