Show the source code for

     

1. (TCO 3) Show the source code for a C# console application called “Area” to display the area of a parking lot with length 203.5 ft. and width 30.5 ft. (Note that area is length times width.)

· Declare and initialize appropriate variables for length and width.

· Include at least three descriptive comments.

· State what your program displays when it runs.

· State how you would use the debugger to check the values of your variables as your program runs.

2. (TCO 5) Describe two types of loops that can be used to write the C# code required to print every fifth integer from 0 to 500 (i.e., 0, 5, 10, 15, etc.), each on its own line. Which would be a better choice and why? Write the code using that type of loop. 

3. (TCO 8) Briefly describe how parameter passing by-value and by-reference are accomplished in memory. Write statement 1 to call method A below. Write statement 2 to call method B. Which method uses pass by-value? Which method uses pass by-reference?

static void Main()
{
int balance = 20000;
//statement 1
//statement 2
}
 

//method A
public static void getBalance(ref int balance)
{
balance = balance + 500;
}
 

//method B
public static int getBalance(int balance)
{
return (balance + 500);
}

How could each of the three errors be corrected to improve the user experience?

. (TCO 9) Identify an example of one of each of the following GUI design errors in Figure 2:

· inconsistency

· misalignment

· clutter

Tags: No tags