Lab2, due Tuesday, Jan 17
In this program, you will get the lengths of the sides of a triangle from a
user and display the sides in order from smallest value to largest value,
the type of triangle, and whether or not it forms a right triangle.
The choices for type are
- no -- does not form triangle -- invalid lengths
(for example, user enters 4 1 1 or 1 -5 -2)
- equilateral -- all sides are equal length
- isosceles -- only two sides are of equal length
- scalene -- all three sides are different lengths
The output of each MsgBox will produce something similar to:
   
The numbers sorted: -3 -3 50 form no triangle
and is not right triangle
   
The numbers sorted: 44 44 90 form no triangle
and is not right triangle
   
The numbers sorted: 30 30 50 form isosceles triangle
and is not right triangle
   
The numbers sorted: 10 10 10 form equilateral triangle
and is not right triangle
   
The numbers sorted: 3 4 5 form scalene triangle and
is right triangle
If you wish to leave off the last phrase about not forming a right triange
when the numbers don't form a valid triangle, that is fine. In other words,
the output for the first two sets of data may be displayed as
   
The numbers sorted: -3 -3 50 form no triangle
   
The numbers sorted: 44 44 90 form no triangle
Three lengths do not form a triangle if the sum of the two smallest sides
are less than or equal to the longest side. You can imagine this by
thinking of 3 sticks. If the 2 smaller ones are attached to the end of the
longest one and they don't meet, it cannot form a triangle.
A triangle is a right triangle if the sum of the squares of the two
shortest sides equals the square of the longest side.
If A, B, and C represent the sides, you often hear this stated as
A squared plus B squared is equal to C squared.
Assignment Notes
-- You will write a .vbs file (no html in lab2), called lab2.vbs.
To create it, either save the one with code examples or create a
.txt file and rename it as a .vbs file.
Use any editor on it.
-- A loop allows the user to repeat entering numbers. The loop is exited
when the user enters three zeros. You will use a loop in this lab in a
manner similar to digits.vbs from the sample code page.
-- You must use at least one boolean variable (has true or false value)
when solving this problem. A boolean variable is typically used to keep
track of whether or not some condition is true. For example, all those
times we check for IsNumeric, suppose I needed this information elsewhere
in my program (you don't in lab2). We could save that information with
the following code. The variable validNums is true or false depending
on whether our input was numeric.
   
...
   
dim validNums
   
validNums = false
   
if IsNumeric(num1) and IsNumeric(num2) and IsNumeric(num3) then
       
validNums = true
   
end if
   
...
   
if validNums then
       
' do something knowing our input was numeric
   
end if
-- You can concatenate strings and numbers to give the kind of output needed.
For example, suppose num
holds the value 45.
The following code
   
dim myOutput
   
myOutput = "hello"
   
myOutput = myOutput & " world " & num
   
MsgBox myOutput
produces the output
   
hello world 45
in a MsgBox.