visual programming assignment
visual programming assignment
The application should allow users to input employee names and log their attendance status (either
"Present" or "Absent"). It will feature input validation, feedback messages, and a display of employee
attendance records.
• Integrated Tools: Visual Studio provides built-in tools for debugging, design, and code
management.
• Event Handling: Easier to manage events and user interactions with visual controls
compared to writing manual event handling code in non-visual languages.
5. Select "Create."
6. Design the Form: Drag a TextBox for employee names, Buttons for "Present" and "Absent", a
ListBox for attendance display, and a Label for feedback.
• Use a non-visual approach by creating a background process that checks a predefined list of
employees.
• Implement logic in Python or C# to update attendance records based on the day of the week.
csharp
Copy code
private void btnSubmit_Click(object sender, EventArgs e)
if (!string.IsNullOrWhiteSpace(txtEmployeeName.Text))
listBoxAttendance.Items.Add(txtEmployeeName.Text);
txtEmployeeName.Clear();
csharp
Copy code
}h
• Dictionary<string, string>: To store employee names with their attendance status (e.g.,
{"John Doe": "Present"}).
9. Input Validation
csharp
Copy code
if (string.IsNullOrWhiteSpace(txtEmployeeName.Text))
else
// Add to list
csharp
Copy code
Console.WriteLine(listBoxAttendance.Items[i].ToString());
Using a switch statement is more efficient when dealing with multiple distinct cases, as it can
optimize performance. For just two options, if-else might suffice, but switch enhances readability.
csharp
Copy code
{
StringBuilder attendanceList = new StringBuilder();
attendanceList.AppendLine(item.ToString());
textBoxAttendanceDisplay.Text = attendanceList.ToString();
aThe loop will run indefinitely since i is decremented. Change it to i++ to increment i and prevent an
infinite loop:
csharp
Copy code
int i = 0;
Console.WriteLine(i);
vb
Copy code
Loop
Visual programming allows users to create programs using graphical elements rather than text code.
Examples include C# and Visual Basic.
The main difference lies in the way code is created: visual programming uses graphical elements,
while non-visual relies on writing text code, which can be more complex and less intuitive.
5. Click "Create."
IDEs provide tools for debugging, version control, and design, which streamline the development
process, making it easier and faster compared to basic text editors.
This approach ensures the application meets the needs and expectations of users, focusing on
usability, accessibility, and overall user experience.
Code Snippet:
csharp
Copy code
Event-driven programming allows for responsive UIs that react to user actions, promoting a better
user experience over procedural code that may block UI updates.
Elements: TextBoxes for name, email, and password; Buttons for submit and cancel.
Validation Handling:
1. int
2. string
3. bool
4. double
5. List<T>
vb
Copy code
For i As Integer = 1 To 10
Console.WriteLine(i)
Next
The logic incorrectly checks if number is less than 5 or greater than 15. Since number is 10, it will
print "Between 5 and 15," which is correct. No change needed.
Code Snippet:
csharp
Copy code
Syntax refers to the set of rules that defines the combinations of symbols that are considered
correctly structured programs. For example, variable declaration differs between C# (int number;)
and VB (Dim number As Integer).
Visual programming languages enhance the development experience by providing visual elements
that make it easier to conceptualize program structure, reducing the cognitive load on developers.
Code Snippet:
csharp
Copy code
• Combo Box: User can select from a list or input text, providing more control over input.
Predefined controls offer quick implementation and consistency, while custom controls allow for
unique designs but may require more time and effort to develop.
Use switch for multiple discrete cases for better readability and potentially better performance. Use
if-else for complex conditions that require logical comparisons.