330 - C# Programming - R - 2021
330 - C# Programming - R - 2021
Time: ___________________
Rank: _______________
C# PROGRAMMING
(330)
REGIONAL 2021
PRODUCTION PORTION:
GENERAL GUIDELINES:
Failure to adhere to any of the following rules will result in disqualification:
1. Contestant must hand in this test booklet and all printouts if any. Failure to do so will result
in disqualification.
2. No equipment, supplies, or materials other than those specified for this event are allowed in
the testing area. No previous BPA tests and/or sample tests (handwritten, photocopied, or
keyed) are allowed in the testing area.
3. Electronic devices will be monitored according to ACT standards.
Your name and/or school name should not appear on any work you submit for grading. Remember
to use your contestant # where appropriate.
Submit a copy of your entire solution/project to the flash drive provided. You must submit your
entire solution/project so that the graders may open your project to review the source code and/or
build and execute your solution/project. Submissions that do not contain source code will not be
graded.
Development Standards
In this exercise, you will create a C# Windows Form Application that serves as an
introductory software package for financial calculations. There will be two tabs in your program-the
first tab you will create a standard four-function calculator. In the second tab, you will be creating a
compound interest calculator.
Requirements:
1. You must create a C# Windows Form Application named CS _330_ContestantNumber,
where ContestantNumber is your BPA assigned contestant number (including dashes). For
example, CS_330_01_2345_6789.
2. Your contestant number must appear as a comment at the top of the main source code file.
3. The main form must not have minimize or maximize buttons in the Form Handle.
4. The main form must have text “Finance Calculator” for its title. The form must start in the
center of the screen and must have a Fixed Dialog setting so the size cannot be adjusted.
5. The main form must have a tab control containing two tabs.
a. The tab control must be named “calculatorTabs”, with Dock set to Top.
b. The first tab must be named “tabCalculator” with text “Calculator.” It must have one
text box called “outputBox”. In addition, it will need buttons for numbers 0 to 9 (10
total), “.”, “=”, “/”, “x”, “-“, “+”, and a button called “Clear”. The number buttons,
period ( . ) and = must all be same color, the four operations (+, -, x, /) need to have
the same color…and the “Clear” button needs to be a separate color. The buttons
must have the following text center aligned in 25-30pt font with button names (Text :
ObjectName):
i. 0 : btn0
ii. 1 : btn1
iii. 2 : btn2
iv. 3 : btn3
v. 4 : btn4
vi. 5 : btn5
vii. 6 : btn6
viii. 7 : btn7
ix. 8 : btn8
x. 9 : btn9
xi. . : btnPeriod
xii. = : btnEquals
xiii. + : btnPlus
xiv. - : btnMinus
xv. x : btnMultiply
xvi. / : btnDivide
xvii. Clear : btnClear
c. The second tab must be named “tabInterest” with text “Compound Interest.” It must
contain the following items:
i. Three labels (Text : ObjectName):
C# PROGRAMMING
REGIONAL 2021
Page 4 of 8
1. Initial Dollar Amount : lblAmount
2. Rate of Interest : lblRate
3. Number of Years : lblYears
ii. Four textboxes with the following names:
1. txtDollars
2. txtInterest
3. txtYears
4. cmpdOutput
iii. GroupBox with the following name:
1. grpFrequency
iv. Four radio buttons (Text : ObjectName):
1. Monthly : rdoMonthly
2. Quarterly : rdoQtr
3. Semiannually : rdoSemi
4. Annually : rdoAnnually
v. Button with the following: Calculate : btnCalculate
6. When the program loads, the Calculator tab needs the following:
a. Black background
b. The “outputBox” needs to be center aligned and 25-30pt font and begin with a “0” as
its default text. It should be able to display real numbers.
c. The following buttons must use a single click event called “click_btn”:
i. 0 to 9, and the period ( . )
ii. This click event should capture the text from the buttons and will be
displayed in the “outputBox”
iii. When any of these buttons are pressed the “outputBox” default “0” text is
replaced
iv. When the period button is pressed, only one period will ever appear in the
“outputBox”
d. The following buttons must use a single click event called “operator_Click”
i. +, -, x, /
ii. The method for this event should store which operator was clicked with a
variable.
iii. If an operator is pressed a second time, then the sub total value should display
in the “outputBox”; for example: if you press the buttons “5” “x” “5” and
then pressed press “+”…the “outputBox” should display 25 temporarily and
then you can press which ever number you want to add to 25.
e. The “=” button will have a click event call equalBtn_Click.
i. Based upon which operator was clicked, when this event is activated it will
perform whichever math operation was selected.
ii. It will send the correct answer to the “outputBox”.
f. When the “Clear” button is clicked the “outputBox” has its text value set back to
“0”.
C# PROGRAMMING
REGIONAL 2021
Page 5 of 8
7. The Compound Interest tab needs the following:
a. Use this formula to calculate compound interest: A = P*(1+(r/n))^(nt)
i. A = the future value of the investment or loan.
ii. P = Principal investment amount (this will be a double value).
iii. r = annual interest rate (this is entered in as a decimal value in the formula;
use a double data type).
iv. n = number of times interest is compounded per unit of t (integer).
v. t = time the money is invested (we are only using complete years; integers
only).
vi. For example: $5,000 borrowed with annual interest rate of 5%, compounded
monthly (12 times), after 10 years, the investment is $8,235.05.
1. A = 5000(1+ (0.05/12))^(12*10) = 8235.05
vii. Another example: $755.23 borrowed with annual interest rate of 20%
compounded semiannually (2 times), after 7 years, the investment is
$2,867.98.
b. When outputting the answer it needs to be formatted with a “$” symbol and to have
only two decimal places (hint there is a currency format in C#).
c. White background
d. User will enter in the Initial Dollar Amount (no $ should be included) and can
include cents; a message box appears for incorrect data entry.
e. The Rate of Interest is entered as a whole number (no % should be included); a
message box appears for incorrect data entry.
f. The Number of Years should be whole numbers only (no decimal places); a message
box appears for incorrect data entry.
g. The radio buttons (n values per the formula) should be set to the following:
i. Monthly: 12
ii. Quarterly: 4
iii. Semiannually: 2
iv. Annually: 1
h. When the “Calculate” button is pressed, it will initiate an event called
“btnCalculateInterest”; this event will perform the calculation of compound interest
based upon the variable information received from the text fields and from the radio
button that is selected.
C# PROGRAMMING
REGIONAL 2021
Page 6 of 8
Sample Pictures:
Figure 1: This is the layout of the four-function calculator.
Program Execution
Code copied to USB drive and program runs from USB ____ 20 pts
If the program does not execute, then the remaining items in the program executive section receive
a score of zero.
There are only two tabs with the titles Calculator and Compound Interest ____ 10 pts
The title of the form is present “Finance Calculator ____ 10 pts
The main form does not have minimize or maximize buttons
in the Form Handle ____ 10 pts
The main form has a tab control named “calculatorTabs”
with Dock set to Top ____ 10 pts
The form’s start position is the center of the screen and it cannot be resized ____ 10 pts
Each tab page has the correct buttons, text boxes, radio buttons and
labels based upon the Figures ____ 20 pts
Calculator: all number buttons make their value appear in “outputBox” ____ 20 pts
Calculator: user cannot enter more than one period ____ 20 pts
Calculator: default “0” is replaced with the first number button pressed ____ 20 pts
Calculator: calculations are performed properly ____ 30 pts
Calculator: second operator press displays sub total value ____ 30 pts
Compound Interest: message box appears if incorrect data is entered into
any text boxes and allows user to renter information ____ 30 pts
Compound Interest: no calculation is performed until proper data is entered ____ 30 pts
Compound Interest: calculations are performed properly
when Calculate button is pressed ____ 30 pts
REGIONAL 2021
PRODUCTION PORTION:
Sample Pictures:
Figure 1: This is the layout of the four-function calculator.
Your name and/or school name should not appear on any work you submit for grading. Remember
to use your contestant # where appropriate.
Submit a copy your entire solution/project to the flash drive provided. You must submit your entire
solution/project so that the graders may open your project to review the source code and/or build
and execute your solution/project. Submissions that do not contain source code will not be
graded.
Development Standards
Program Execution
Code copied to USB drive and program runs from USB ____ 20 pts
If the program does not execute, then the remaining items in the program executive section receive
a score of zero.
There are only two tabs with the titles Calculator and Compound Interest ____ 10 pts
The title of the form is present “Finance Calculator ____ 10 pts
The main form does not have minimize or maximize buttons
in the Form Handle ____ 10 pts
The main form has a tab control named “calculatorTabs”
with Dock is set to Top ____ 10 pts
The form’s start position is the center of the screen and it cannot be resized ____ 10 pts
Each tab page has the correct buttons, text boxes, radio buttons and
labels based upon the Figures ____ 20 pts
Calculator: all number buttons make their value appear in “outputBox” ____ 20 pts
Calculator: user cannot enter more than one period ____ 20 pts
Calculator: default “0” is replaced with the first number button pressed ____ 20 pts
Calculator: calculations are performed properly ____ 30 pts
Calculator: second operator press displays sub total value ____ 30 pts
Compound Interest: message box appears if incorrect data is entered into
any text boxes and allows user to renter information ____ 30 pts
Compound Interest: no calculation is performed until proper data is entered ____ 30 pts
Compound Interest: calculations are performed properly
when Calculate button is pressed ____ 30 pts