# Project #25626 - programming

1. FIRST POST: Refer to pages 135-138 in your text and/or search on line if necessary for this question.
Give two examples of exceptions that would be common in a program you may write. Pick two different types of exceptions from Table 3.2 on page 137 of the text. Describe the error, what the user or system may have done to cause the error, and the best way to handle the error using the try/catch block.
For one of the exceptions you selected, write the complete try/catch block as it would be seen in a program you write. Include the Exception Object (see example highlighted in blue at the bottom of page 137) to create a message to the user about the error that occurred.
SECOND POSTING: Explain how you would make a dollar amount calculation stored in amountDecimal display in amountTextBox as a number with a dollar sign, commas if appropriate and shown with two decimal places.

2.
FIRST POSTING: Here is a common selection problem given to many beginning programming students:
A user enters a student grade in numeric format. (0.0-100.0)
Write the code that will display the appropriate letter grade for the numeric grade entered. For example:
Display ‘A’ if the numeric grade is 90 or above.
Display ‘B’ if the numeric grade is < 90 and >= 80.
Display ‘C’ if the numeric grade is < 80 and >= 70.
Display ‘D’ if the numeric grade is < 70 and >= 60.
Display ‘F’ if the numeric grade is < 60.

If your student ID ends in an even number, write the code for the problem above as an if…then…else statement (see pages 171 & 173 for multiple “if” examples).
If your student ID ends in an odd number, write the code for the problem above as a switch statement (see pages 182-184 for “switch” examples).

HINT/WARNING: By now, you should be able to use the “AND” (&&) and “OR” (||) operators. But, you have not yet learned the correct syntax for printing text. Printing is discussed in a later chapter. For now, to print a grade letter, just use the word “print” like this:
print ‘B’;
and the text does not discuss how to cover a range of numbers in a case statement, so use this:
case >= 90:
print ‘A’;
break;
case 80.0 to 89.99
print ‘B’;
etc.

SECOND POSTING:
Which method seems best to you? (switch or if…then…else) Why do you think there are two different methods available in C#?

 Subject Computer Due By (Pacific Time) 03/22/2014 12:00 am
TutorRating
pallavi

Chat Now!

out of 1971 reviews
amosmm

Chat Now!

out of 766 reviews
PhyzKyd

Chat Now!

out of 1164 reviews
rajdeep77

Chat Now!

out of 721 reviews
sctys

Chat Now!

out of 1600 reviews

Chat Now!

out of 770 reviews
topnotcher

Chat Now!

out of 766 reviews
XXXIAO

Chat Now!

out of 680 reviews