Pinata pricing

You sell three different types of pinatas. Pandas cost $14 each, lambs cost $12 each, and bunnies cost $9 each. Write a program that computes the total price of an order.

Here's a sample:


The program validates the three input fields. They should all be numbers zero or more. If any of them is bad, show one error message, like this:


Don't create your own workbook. Download this one instead. It has some code already there:

  1. Private Sub cmdRun_Click()
  2.     Dim pandas As Integer
  3.     Dim lambs As Integer
  4.     Dim bunnies As Integer
  5.     Dim inputOK As Boolean
  6.     Dim totalPrice As Integer
  7.     'Input
  8.     getInputs pandas, lambs, bunnies, inputOK
  9.     If Not inputOK Then
  10.         'There was a problem with the input.
  11.         End
  12.     End If
  13.     'Compute the total price.
  14.     computePrice pandas, lambs, bunnies, totalPrice
  15.     'Output the total prie.
  16.     outputPrice totalPrice
  17. End Sub
Don't change this code! Don't add or remove anything. Your job is to write the Subs. All the usual coding standards apply.

Upload your completed workbook.

In the text section of the submission form, please answer this question: what did you learn from this exercise?

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Referenced in: