Clown clearance

Tags
Challenge
No

The sleepy town of Fall's End, Montana, has been invaded by evil aliens! They have turned the townsfolk into lava lamps. There are roughly forty aliens, though the exact number is not known.

Poor research led the aliens to disguise themselves as clowns. They thought they would blend in with the locals.

Marcella has discovered felines are the only creatures unaffected by the aliens' transmogrifiers.

Write a program to help her figure out how many leopards, lions, and tigers to rent.

Here's some I/O:

  • How many leopards? 4
  • How many lions? 4
  • How many tigers? 3
  •  
  • Clowns eaten: 45
  • Price: $88400

Here's some more:

  • How many leopards? 5
  • How many lions? 5
  • How many tigers? 3
  •  
  • Clowns eaten: 51
  • Price: $100900
  • Warning: you don't have that much.

And even more:

  • Clown clearance
  • ===== =========
  •  
  • How many leopards? lots
  • Sorry, you must enter a whole number.
  • How many leopards? 3.5
  • Sorry, you must enter a whole number.
  • How many leopards? 3939
  • Sorry, please enter a number from 0 to 6.
  • How many leopards? 1
  • How many lions? -44
  • Sorry, please enter a number from 0 to 5.
  • How many lions? 1
  • How many tigers?
  • Sorry, you must enter a whole number.
  • How many tigers? 1
  •  
  • Clowns eaten: 13
  • Price: $25300

Validate the three inputs. Keep asking until the user enters valid values. They must be integers, and cannot be less than zero. In addition, leopards cannot be more than six, lions cannot be more than five, and tigers cannot be more than three.

Write a reusable function to get one numeric input at a time. Call it three times.

Compute and output the cost, and the number of clowns eaten. Each leopard costs $4,000, and will eat two clowns. Each lion costs $8,500, and will eat four clowns. Each tiger costs $12,800, and will eat seven clowns.

Marcella has $90,000 in her wallet. If the total cost is more than $90,000, show a warning message along with the output.

Upload a zip of your project folder. The usual coding standards apply.

Where referenced