Вы находитесь на странице: 1из 4

CIT-110 C# Programming 1: Real Estate

Background:
The purpose of this assignment is to apply all that new knowledge you learned during our previous
classes. To recap we learned how to create a basic form, add controls, and adjust the form layout,
change properties, code click events and work with arrays and collections.
The owner of BDJ Real Estate of Springfield has hired you to design a sales analyzer program for real
estate sales. You can enter the property sales by supplying a valid sales dollar amount and pressing the
Add button. You dont know up front of how many entries you will have. What makes more sense to
use an array or collection?
Once the data entry is complete you can press on the Calculate button to find out the different analytics
for the sales: Min, Max, Average, Median, Total and Commission.

There are three Label controls


There is one TextBox control
There are two ListBox controls
There are buttons Calculate, Add, Clear and Exit.
Odd Number Example

Even Number Example

Grading Elements
All Form properties set as instructed
All Label properties set as instructed
All TextBox properties set as instructed
All Button properties set as instructed
Tab Order properties set as instructed and not stopping at output only
List Collection is populated correctly
Data validation on the TextBox
The Calculations are done properly
All Controls and Variables coded with a prefix (Hungarian Notation)
Code has comments

Possible Points
(100 total)
5
5
5
5
5
25
5
35
5
5

Detailed Instructions:
1. Create a new C# Windows Forms Application called RealEstateCollections.
2. On the form do the following:
Using the Solutions Explorer Window change the File Name from Form1.cs to
frmRealEstateCollections.cs
Using the Properties Window change the Text property to [Your Name] Real Estate
Have the form startup in the center of the screen
3. Add 3 Label controls to the form and do the following:
The first labels Name property should be lblPropertyValue with the text Property
Value.
The second labels Name property should be lblEnteredValues with the text of
Entered Property Values.
The third labels Name property should be lblAnalysis with the text of Property Value
Analysis.
4. Add 1 TextBox controls to the form and do the following:
The first Name property should be txtPropertyValue, aligned center with a max size of
8
5. Add 2 ListBox controls to the form and do the following:
The first Name property should be lstEnteredValues.
The second Name property should be lstAnalysis.
6. Add 4 Button controls:
The first buttons Name property should btnCalculate, Text property should be
Calculate with an alternate key on the C
The second buttons Name property should btnAdd Text property should be Add with
an alternate key on the A
The third buttons Name property should btnClear Text property should be Clear with
an alternate key on the l
The fourth buttons Name property should btnExit, Text property should be Exit with
an alternate key on the x
Use Visual Studio tools to make sure the Buttons are the same size, aligned to the
bottom and have equal horizontal spacing
Link the btnCalculate to the forms AcceptButton property
Link the btnExit to the forms CancelButton property
7. Set the tab order to move from the top of the screen to the bottom from left to right. You
shouldnt stop at the output only ListBox controls.
3

8. Coding of Calculate button:


You can only perform the sales analysis if there are entries in the collection. If the list
collection has 0 entries inform the user, select the text, set the focus and exit the event
handler:
If the collection does have value(s) do the following:
1.Sort the entries in the list collection
2.Enter a loop to process each entry in the list collection and output the entry
number and the value formatted it as currency with 2 decimal positions.
3. Determine the Minimum value in the collection and add to the lstAnalysis
Listbox and format it as currency with 2 decimal positions.
4.Determine the Maximum value in the collection and add to the lstAnalysis
Listbox and format it as currency with 2 decimal positions..
5. Determine the Average value in the collection and add to the lstAnalysis
Listbox and format it as currency with 2 decimal positions..
6.Determine the median as follows:
1. If the number of entries in the list collection is odd, divide the count
by 2 and use that entry as the median
2. If the number of entries in the list collection is even divide the count
by 2. Take that that entry and the entry before it and average the two
elements and use that as the median.
7.Determine the Total value in the collection and add to the lstAnalysis Listbox
and format it as currency with 2 decimal positions.
8.Determine the Commission by multiplying the Total of the calculation by .03
and add to the lstAnalysis Listbox and format it as currency with 2 decimal
positions.
9. Coding of the Add button:
Attempt to convert the value in the txtPropertyValue to a decimal. If it isnt a valid
decimal inform the user, select the text, set the focus and exit the event handler
If the TextBox value is a valid decimal add it to the list collection. Something to
think about: If the collection will be used in multiple click events, how and where do
you declare the list so the whole program can access it?
Add the decimal value to the lstEnteredValues ListBox and keep track of the number
of entries. Something to think about: How can you declare the counter variable so
the value is preserved when the click event is exited?
10. Coding of the Clear button:
Clear the txtPropertyValue TextBoxes
Clear the lstEnteredValues ListBox
Clear the listDecPropertyValuesListBox
Clear the list collection
Reset the counter that keeps track of on the number of entries
11. Coding of the Exit button:
Exit the application
Congratulations you did it! Take how many hour$ you worked on thi$ application and multiply it by
$60 and that i$ how much money you would make being a C# con$ultant.

Вам также может понравиться