Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Objective: This assignment is designed to learn programming in VB.NET. Questions

ID: 3785216 • Letter: O

Question

Objective:

This assignment is designed to learn programming in VB.NET.

Questions:

(2 marks) In Visual Studio, create a VB.NET Console Application that does the following:

Create three variables of String data type, called firstName, lastName, and fullName respectively;

Assign your first name to the variable firstName;

Assign your last name to the variable lastName;

Concatenate the variable firstName, a string containing a space (i.e., “ ”), the variable lastName together, and then assign the result to the variable fullName;

Display your name in the console window using the statement Console.WriteLine(fullName)

(3 marks) In Visual Studio, create a VB.NET Console Application that does the following:

Create a variable of Integer data type, called marks;

Create a variable of String data type, called grade;

Assign 88 to marks;

Convert marks into grade as follows using the Select-Case statement:

marks

grade

90-100

A+

85-89

A

80-84

A-

77-79

B+

73-76

B

70-72

B-

67-69

C+

63-66

C

60-62

C-

50-59

D

0-49

F

(5) Display the values of marks and grade in the console window using the statements

Console.WriteLine(marks)

Console.WriteLine(grade)

(2 marks) Repeat Question 2 using the If-Then-ElseIf statement (instead of the Select-Case statement). Your output should be exactly the same as that of Question 2.

(3 marks) In Visual Studio, create a VB.NET Console Application that uses the While loop to display all leap years between 2017 and 2050. A leap year between 2017 and 2050 is a year that is an integer multiple of 4 (i.e., year Mod 4 = 0). For example, 2020 and 2040 are leap years. (Hint: you need both the While and If-Then statements.)

For each question, print the program and handwrite the output at the end of the printout of the program.

marks

grade

90-100

A+

85-89

A

80-84

A-

77-79

B+

73-76

B

70-72

B-

67-69

C+

63-66

C

60-62

C-

50-59

D

0-49

F

Explanation / Answer

Ans 1:-

Public Class Form

   Private Sub Button_Click(sender As Object, e As EventArgs) Handles Button.Click
      
       Dim firstName As String
       Dim lastName As String
       Dim fullName As String
      
       firstName = "Remo"
       lastName = "Fernandes"

       fullName = firstName & " " & lastName

       Console.WriteLine(fullName)

   End Sub

End Class