Question: These are Visual C# questions Write instructions to do each of the following. Make up appropriate names for the variables. Create a Boolean variable and
These are Visual C# questions
- Write instructions to do each of the following. Make up appropriate names for the variables.
- Create a Boolean variable and assign it a value of True.
- Create a Decimal variable and assign it a value of 1.25
- Create a Double variable and assign it a value of 3.4.
- Create a String variable and assign it a value of Maybe
- Create a Char variable and assign it a value of X.
- Which of the following statements are valid?
- string message = Page + 1;
- float amt1 = 1;
- float amt2 = 1.0f;
- float amt3 = 1.0;
- decimal amt4 = 1.0;
- Assume that the variables X, Y, and N have been declared as doubles and assigned values. Write and instruction to assign a value to Y as Y = XN.
- Assume that txtAmount is a text box with a number in it. Write instructions to get the number and store it in each of the following variables.
- int amount1;
- double amount2;
- decimal amount3;
- Assume that txtAmt1 and txtAmt2 are textboxes and that dblAmt1, dblAmt2, and dblTotal are variables of type double. Write a try-catch block which will get the numbers from the text boxes and assign them to the corresponding variables. After that, add dblAmt1 plus dblAmt2 giving dblTotal. Display The total is and the value of dblTotal in a message box. However, if an exception occurs, catch it and display Invalid Data in a message box.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
