Professional Documents
Culture Documents
Coti 4150 Eval 01
Coti 4150 Eval 01
Coti 4150 Eval 01
Evaluation #1
(Value: 60 points)
Requirements
1. (15 points) Write a Console application that computes compound interest. The application should
display a table of the amount on deposit by the user for each year based on the principal, the annual
interest rate and the number of years entered.
Enter principal: $1000
Enter annual interest rate (%): 5
Enter number of years: 10
1
Use the following formula to determine the amounts:
a = p(1 + r)n
where
p is the principal (original amount invested),
r is the annual interest rate,
n is the number of years and
a is the amount on deposit at the end of the nth year
Validations: Your application should only allow a decimal between $100.00 and $10,000.00 for the
principal, a decimal between 0.0% and 100.0% for the annual interest and an integer between 1 and
20 for the number of years.
2
2. (20 points) Write a WinForms application that computes the federal income tax that is owed by the
user for the taxable income amount entered. The following is its user interface:
Note: The percentage is calculated as an integer. For example, if the taxable income is $35,350 then
the income tax is $922.50 plus (the 15% of $26,125, as an integer). You must use type casting and a
switch expression.
Validations: Your application should only allow a non-negative integer for the taxable income. This
application must validate input using basic exception handling by throwing exceptions with throw
and catching them by using try-catch.
3
3. (25 points) Write a WinForms application that computes the charges for a guest staying at the
Highlander Hotel based on the given data and assuming a tax rate of 8%. The following is its
user interface:
Input and output controls should be inside their corresponding group box. To display the current day
and time as soon as the form loads, use this event handler:
private void RoomChargeForm_Load(object sender, EventArgs e)
{
lblCurrentDate.Text = DateTime.Now.ToLongDateString();
lblCurrentTime.Text = DateTime.Now.ToLongTimeString();
}
Validations: Your application should only allow an integer between 1 and 30 for the number of
nights, a decimal between $50.00 and $100.00 for the night charge, a decimal between $10.00 and
$15.00 for the room service charge, a decimal between $5.00 and $7.50 for the telephone charge and
a decimal between $0.00 and $10.00 for the miscellaneous charges. This application should validate
input using validation methods.
4
General Notes
1. In your WinForms applications, the user should be able to set the focus for input controls by using
an access key, pressing Tab or clicking on them.
2. In your WinForms applications, output must be cleared as soon as any input value changes.
3. All output must be formatted according to the type of information displayed.
4. You should refactor the relevant event handlers to extract secondary processing methods.
5. Your applications should follow the coding guidelines for this course.