Assignment 1 Visual Programming
Assignment 1 Visual Programming
Objective
Instructions:
1. Conceptual Questions:
o a. Explain what a variable is in the context of VB.NET and why
variables are important in programming.
o b. List and describe at least three different data types available in
VB.NET (e.g., Integer, String, Boolean).
2. Coding Exercises:
o a. Write a VB.NET code snippet that declares and initializes the
following variables:
▪ An integer variable named age initialized to 30.
▪ A string variable named firstName initialized to "John".
▪ A Boolean variable named isActive initialized to True.
o b. Add code comments to explain the purpose of each variable.
3. Reflection:
o Write a short paragraph on how declaring variables helps in making
code more flexible and maintainable.
Instructions:
1. Conceptual Questions:
o a. Define what a constant is and explain how it differs from a
variable.
o b. Provide an example scenario where using a constant would be
beneficial in an application.
2. Reflection:
o In your own words, explain why constants are useful, particularly in
cases where a value should not change throughout the execution of
the program.
Instructions:
1. Conceptual Questions:
o a. Describe what type conversion and casting are in VB.NET.
Include the differences between implicit and explicit conversion.
o b. Explain why type conversion might be necessary when working
with different data types.
2. Application Questions:
o a. Imagine you have a VB.NET application that receives user input
as text (a string). Describe how you would safely convert this input
to an integer and handle any potential errors.
o b. Write a small function that takes a string parameter, attempts to
convert it to an integer, and returns the integer value. If the
conversion fails, the function should return 0 and print an error
message.
Evaluation Criteria:
• Asks the user for their name, age, and a number as text.
• Converts the text input for the number into an integer.
• Uses a constant to calculate and display a simple mathematical operation
(e.g., multiplying the number by a fixed factor).
• Displays all the collected and computed information in a formatted
message box.