Write a program to give advice on how many dogs people should have. The program starts like this:
The user puts a number in cell B1, and clicks the button. Advice appears:
Use this table:
Dogs | Advice |
0 | Get some dogs! |
1 | Get another dog. |
2 | That's the right number of dogs. |
More than 2 | You have too many dogs. |
Here's some code. You don't have to use it.
Option Explicit
Private Sub cmdRun_Click()
Dim numDogs As Integer
Dim advice As String
'Input.
numDogs = Cells(1, 2)
'Processing.
[Your code here.]
'Output.
Cells(4, 1) = advice
End Sub
An Integer
is a type of number; specifically, it's a whole number. More on that later.
You can assume that users make no errors when they type in their input.
Upload your solution. The usual coding standards apply.
(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)
Keywords: