Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create and test all 6 console applications in Visual Studio for this assignment. (1) In Visual Studio, create and test a console application that does

Create and test all 6 console applications in Visual Studio for this assignment.

(1) In Visual Studio, create and test a console application that does the following: (a) Create three variables of the String data type, named firstName, lastName, and fullName respectively; (b) Use the built-in function Console.ReadLine() to get the users input for firstName and lastName using the following statements: Console.WriteLine(Enter your first name:) firstName = Console.ReadLine() Console.WriteLine(Enter your last name:) lastName = Console.ReadLine() (c) Concatenate the variables firstName and lastName together, and then assign the result to the variable fullName as follows (there is a space between the two double quotes): fullName = firstName & & lastName (d) Use the following statement to display the output: Console.WriteLine(Thank you & fullName) (2) In Visual Studio, create and test a console application that does the following: (a) Create three variables of Integer data type, named x, y, z respectively; (b) Use the built-in function Console.ReadLine() to get the users input for x and y as follows (it is assumed that the user always inputs integers when testing this program): Console.WriteLine(Input the first number:) x = CType(Console.ReadLine(), Integer) Console.WriteLine(Input the second number:) y = CType(Console.ReadLine(), Integer) (c) Compute the smaller of x and y, and then assign the result to z as follows: If (x < y) then z = x Else z = y End If (d) Use the following statements to display the output: Console.WriteLine(The smaller of the two numbers is) Console.WriteLine(z)

(3) In Visual Studio, create and test a console application that does the following: (a) Create three variables of Integer data type, named x, y, z respectively; (b) Use the built-in function Console.ReadLine() to get the users input for x, y, z as follows (it is assumed that the user always inputs integers when testing this program): Console.WriteLine(Input the first number:) x = CType(Console.ReadLine(), Integer) Console.WriteLine(Input the second number:) y = CType(Console.ReadLine(), Integer) Console.WriteLine(Input the third number:) z = CType(Console.ReadLine(), Integer) (c) Display the sum of the three numbers using the following statements: Console.WriteLine(The sum of the three numbers is) Console.WriteLine(x+y+z) (4) In Visual Studio, create and test a console application that does the following: (a) Create a variable of the Integer data type, named marks; (b) Create a variable of the String data type, named grade; (c) Use the built-in function Console.ReadLine() to get the users input for marks as follows (it is assumed that the user always inputs integers when testing this program): Console.WriteLine(Input the marks:) marks = CType(Console.ReadLine(), Integer) (d) Convert marks into grade as follows using an If-Then-ElseIf 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 (e) Display the value of grade in the console window using the following statement: Console.WriteLine(The grade is & grade) Hint: The If-Then-ElseIf statement is a lengthy one and is similar to the following: If ((marks >= 90) And (marks <=100)) Then grade = A+ ElseIf ((marks >= 85) And (marks <=89)) Then grade = A ......... ......... ElseIf ((marks >=0) And (marks<=49) Then grade = F Else

grade = undefined End IF (5) Repeat Question 4 using the Select-Case statement (instead of the If-Then-ElseIf statement). Hint: The Select-Case statement is a lengthy one and is similar to the following: Select Case marks Case 90 To 100 grade = A+ Case 85 To 89 grade = A ......... ......... Case 0 To 49 grade = F Case Else grade = undefined End Select (6) In Visual Studio, create and test a console application that uses the While loop to display all leap years between 2022 and 2050. A leap year between 2022 and 2050 is a year that is an integer multiple of 4 (i.e., year Mod 4 = 0). For example, 2024 and 2040 are leap years.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions