Windows Application Using Combo Box and Distance from Al Khobar

Verified

Added on  2019/09/16

|5
|1201
|280
Project
AI Summary
The assignment is to develop a Windows application that uses a combo box to display the names of several Saudi cities and their distances from Al Khobar. The app should also display a map of the selected city when the user selects it from the combo box.

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Fall semester (2016-2017)
MISY 2313: Intermediate Programming for Information Systems
Dr. Samer Al-Imamy
Project#1
Development Windows C# Application
(Practice the use of visual controls, methods, Internet and
Files)
Learning outcome:
This assignment meets the following course learning outcomes:
2. Design and write small programs in Microsoft Visual C# .Net.
3. Illustrate the techniques of defining program requirements.
4. Develop and program a graphic user interface (GUI).
5. Write programs that interface with the Internet and Internet programming languages.
6. Deploy the principles of basic file types.
Available: 4 December 2016
Students’ upload to blackboard by: 25 December 2016
Put the project in a zip file named and upload by one member of the
group. Other members should upload the cover page only.
Marked out of 60 points (contribute 10% to the total mark)
Delay 1 day (-1% of the total mark)
Delay 2 days (-3% of the total mark)
1

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Delay 3 days or more (zero mark)
Description and Requirements
Develop windows application that uses combo box to display the names of several Saudi cities. Set the
names of the cities in a combobox (to be loaded from a text file) and distance from Al Khubar to each of
the above mentioned cities (to be loaded from a text file to an array). When the user selects a city from
the combox, its distance from Al Khobar is displayed as well as the map of that city. To give you a
startup, I will guide you through the important steps of development.
Create and name the controls as shown in the figure above.
Use: 4 labels, 1 comboBox, 1 pictureBox and 1 webBrowser
Where:
cboCities is the name of the a Combo Box control
lblDistance is a label control with font set bigger and bold used for output.
webBrowser1 is a webBrowser control. Make it invisible by setting the visible property to false.
picMap is a pictureBox control. Keep it visible by leaving the visible property at true and load it with
appropriate picture on the design mode.
2
Document Page
The rest are Label controls.
1- Declare a global array called distance of type integer to hold the distances. Set its size to a value
higher than the possible number of cities. I used 20.
2- cboCities combo box
Load the text from a file. Split the text on tab. The file contents looks like the following:
Riyadh 500
Ahsaa 170
Mecca 1370
Medina 1280
Dammam 50
Taif 1300
Tabook 1000
Load the cboCities with the city names and the array with the distances. See the following code:
TextReader tr = File.OpenText(@"d:… \Cities.txt");
string strLine = string.Empty; //or use = “”;
string[] arrColumns = null;
while ((strLine = tr.ReadLine()) != null)
{
arrColumns = strLine.Split('\t');
cboCities.Items.Add(arrColumns[0]);
distance[count++] = arrColumns[1];
}
tr.Close();
The above code will be loaded in the form load method.
3- Program the cboCities method to display the distance in the lblDistance control and the map of the
selected city.
Use a code similar to the following:
lblDistance.Text = distance[cboCities.SelectedIndex];
string htmlText = "<iframe width=\"425\" height=\"350\" src=\"";
if (cboCities.SelectedItem.ToString() == "Mecca")
htmlText += "http://maps.google.com/maps?
f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Mecca,+Makkah+Province,
+Saudi+Arabia&amp;aq=1&amp;oq=Mecca&amp;sll=38.065392,-
95.712891&amp;sspn=46.486464,93.076172&amp;ie=UTF8&amp;hq=&amp;hnear=Mecca,
+Makkah+Province+Saudi+Arabia&amp;t=m&amp;z=11&amp;ll=21.416667,39.816667&amp;
output=embed";
htmlText += "\"></iframe>";
picMap.Visible = false;
webBrowser1.Visible = true;
webBrowser1.DocumentText= htmlText;
If you want to create more maps use the following site: http://maps.google.com/
3
Document Page
Set your cities. Click on the link at the top-right. Copy the link and add it to the application.
Assessments
Grading Items Possibl
e
Points
gained
Points
1. Administration
1.1 Completeness, organization and on time submission.
----------------------------------------------------------------
Submission as a zip file named as the student’s ID
number (1)
Program submitted through the blackboard drop box
(1)
Submitted on time (3) (one day late -1, 2 days late -3)
5
2. Program Quality
2.1 Usability - Correctness of application fulfillment of all
user Requirements.
----------------------------------------------------------------
Labels named and allocated correctly (1)
Combo Box Control set correctly (3)
Picture box set correctly (2)
Picture box visibility set correctly (1)
Web Browser visibility set correctly (2)
Overall program look (1)
10
2.2 Functionality – Application run
--------------------------------------------------------------
Setting cities distances (2)
Switching visibility correctly (2)
Setting the web browser correctly (3)
Overall running (3)
10
2.2 Coding
----------------------------------------------------------------
Writing file and located correctly (4)
Opening the file (4)
Array Declaration (2)
Loading the array (2)
Setting the distance label (2)
Form load programming (4)
Combo Box programming (4)
Overall coding (3)
25
2.3 Robustness 4
2.4 Readability – Internal documentation, code
formatting, adherence to standards in naming
variables, constants, controls, etc.
----------------------------------------------------------------
Internal documentation (2)
Standard naming (2)
4
2.5 Overall creativity/usability of GUI 2
TOTAL MARKS 60
TOTAL PERCENTAGE POINTS 10%
4

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Good Luck
5
1 out of 5
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]