EBS is a company that ships emotional baggage. Write a program that computes the weight of someone's emotional baggage, and the cost of shipping it. The worksheet starts like this:
Users fill in the customer's first name, age, and gender, and then click Run. If the data validates, the program outputs the baggage's weight (in emograms), and the shipping cost. For example:
Validate the three inputs, using the following rules:
- A name must be entered. Case doesn't matter. jAN, Jan, JAN… all the same.
- Age must be a number.
- Gender must be M or F, either upper- or lowercase.
If there is an error, show an error message, and end the program. For example:
Here are the rules for computing weight and cost.
- Weight is 1.9 times age for women, and 1.4 times age for men.
- People whose first name starts with "A" or "E" have an extra 32 emograms of emotional baggage. Nobody knows why.
- Each emogram costs $26.30 to ship.
Hints:
You can check whether a string is empty like this:
That's two double-quotes together, with nothing between them.
You can get the first character of a string like this:
Upload your worksheet.
(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)