Question: Questions relate to Visual C# What is the general format for an if statement? What is the format for an if-else statement? Declare a Boolean

Questions relate to Visual C#

  1. What is the general format for an if statement? What is the format for an if-else statement?

  2. Declare a Boolean variable named validData and assign it a value of true.

  3. What are the Boolean operators for and, or, and not?

  4. What are the Boolean operators for each of the following?

    1. less than

    2. less than or equal to

    3. greater than

    4. greater than or equal to

    5. equal to

    6. not equal to

  5. Assume that strName1 and strName2 are variables of type string and lblResult is a label. Write instructions to do each of the following.

    1. Remove all leading and trailing blanks from strName1.

    2. If strName1 and strName2 are equal, assign the word equal to lblResult.

    3. If strName1 and strName2 are equal (ignoring differences in upper and lower case), assign the word equal when ignoring case to lblResult.

    4. If strName1 is less than strName2, assign the words less than to lblResult.

    5. If strName1 is greater than strName2, assign the words greater than to lblResult.

  6. Assume that dblAmount is a variable of type double and txtAmount is a text box. Write instructions that will use a TryParse to convert the contents of txtAmount into a double and store it into dblAmount. If this cannot be done display a message box saying Invalid data, select the contents of txtAmount, set the focus to txtAmount, and exit the current event-procedure.

  7. Want are radio buttons? What are check boxes? How are they different?

  8. What is the CheckChanged event for a check box?

  9. Write a set if if statements which will look at a character variable named letterGrade and assign a value to pointValue as follows:

  • A is worth 4

  • B is worth 3

  • C is worth 2

  • D is worth 1

  • All others are worth 0

  1. Rewrite problem 9 to use a switch statement.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!