Modern Programming Languages (CS508)
Assignment No. 5
Total Marks: 20 Dead line: 30th Jan, 2013
Purpose of Assignment:
Intended purpose of this assignment is to give students an exercise that can facilitate them while working in any component-based development environment. After attempting this assignment students will be able to:
• To introduce students with a powerful and customizable component-based software language i.e. C#.
• Learn basic syntax of language.
• Students will get comprehensive understanding of important concepts of C# i.e. arrays, conditional statements, fields and etc.
Application:
IdevSpot-Solutions for Software Companies
IdevSpot provides a range of innovative and reliable eBusiness softwares for companies intending to start their own online business and earn profits by offering membership services.
IdevSpot is specifically designed for software markets, It’s scalable and integrated solution includes a full-featured, modular and secure eCommerce platform, a partner order and revenue management system, as well as a constantly expanding worldwide
affiliate network.
IdevSpot market-proven eCommerce solution enables software companies to rapidly embrace industry shifts, reach customers effectively, and adopt new business models with a view to optimizing profitable revenue across online and offline channels.
Scenario:
Idev-Employee
This application of IdevSpot maintains employees’ information. Search engine optimization feature is also available. Employees will be able to login, view and edit their profile. Clean and attractive approach makes this easy to Customize, powerful, robust and
user-friendly.
This C# desktop application is easy enough that inexperienced employees will be able to create their profiles. It is yet powerful and customizable enough that experienced programmers will appreciate both time saved and streamlined organization features
which will make management of their application easy.
Evaluation:
Suppose you are hired as a C# desktop developer by IdevSpot for development of the Idev-Employee application. Your primary job responsibilities include development and regular maintenance. As a part of this development environment developing desktop
application you are required to answer following question:
1. Identify and correct the errors in the given C# program. Give reasons to justify your
answer. Also provide the corrected program. [5]
using System;
class SearchEmp
{
String[] Name= {“Aslam”,”Irfan”,”Afridi”,”Junaid”};
SearchEmp(string name)
{
this.name = name;
}
public void Search()
{
name= “Afridi”;
if(Name[0]==name||Name[1]==name||Name[2]==name||Name[3]==name)
{
Console.WriteLine(“FOUND”);
}
}
private readonly string name;
public static void Main()
{
SearchEmp E1= new SearchEmp(“Kareem”);
E1.Search();
}
}
2. Write a C# program to perform the following tasks.
a. Create ‘Names’ string array which will contain 10 elements. [2]
b. Use For loop to get 10 names from user. [3]
c. Print Names array using foreach loop. [2.5]
d. Get a name and index from user. And replace the name on index (given by user) with the new name. [5]
e. Now use while loop to print the Names array. [2.5]
Sample Output: