Ulma's Ungulates

Challenge
No

Write a program to compute the price of renting an animal from Ulma's Ungulates. You can rent either a llama, or a camel. The price depends on:

  • Which animal you choose.
  • Whether you want to rent a saddle as well.

The worksheet starts like this:

Start

The user fills in the two cells above the Run button, and clicks Run.

Validate all the input, using the following rules:

  • The animal input must be either L or C. Case doesn't matter. Use trim() to remove unwanted spaces.
  • Saddle is either Y or N. Case doesn't matter. Use trim() to remove unwanted spaces.

If there are any input errors, show a message, and end the program. For example:

Error

If the data is OK, output the full name of the animal, a warning, and the cost.

  • Llama rent for $80.
  • Camels rent for $95.
  • Saddles rent for $30.

The warning is "Spits" for llamas, and "Stinks" for camels.

Here's some output:

Output

Another example:

Output

The usual coding standards apply.

Where referenced