Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

University of Puerto Rico at Bayamón

Department of Computer Science


COTI 4150 – Information Systems Programming

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

Yearly account balance...

Year Amount on deposit


1 $1,050.00
2 $1,102.50
3 $1,157.63
4 $1,215.51
5 $1,276.28
6 $1,340.10
7 $1,407.10
8 $1,477.46
9 $1,551.33
10 $1,628.89

Press any key to exit...

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:

Use the following table for calculating the tax:

Taxable income Income tax


Over… But not over… Of excess
over…
$0 $9,225 $0 plus 10% $0
$9,225 $37,450 $922.50 plus 15% $9,225
$37,450 $90,750 $5,156.25 plus 25% $37,450
$90,750 $189,300 $18,481.25 plus 28% $90,750
$189,300 $411,500 $46,075.25 plus 33% $189,300
$411,500 $413,200 $119,401.25 plus 35% $411,500
$413,200 $119,996,25 plus 39.6% $413,200

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.

You might also like