User:Drmksharma/lectuernotes

From WikiEducator
Jump to: navigation, search

                                    MY LECTUER NOTES 

                                       MCA 4th  Semester  (VB.Net and C# )

                                                                   Syallabus

UNIT I

Introduction to C#, CLR, Visual studio console app, Simple windows forms, C# language fundamentals, Enumerations, structures, Namespaces

UNIT II

C# Object oriented programming: OOPs, Encapsulation, Inheritance, Polymorphism, Object Lifetime, Components, Modules, Windows Forms, Interface, Cloneable objects, Comparable objects, Collections Namepaces Advanced Class Construction: Custom Indexer, Overloading operators, Delegates, Events

UNIT III

Assemblies, Thread, and AppDomains: C# assemblies, GAC, threads, contexts, Appdomains, Processes concepts, Concurrency
and synchronization- Locks, Monitors, ReaderWriterLock, Mutexes, Thread pooling,

UNIT IV

IO, Object serialization and remoting: System.IO, Streams, TextWriter, TextReader, BinaryWirter, BinaryReader, Serialized Object Persistence and formatters, Remoting
ADO.Net, C# windows forms for data control: Grid, Datasource and databinding controls, Connected and disconnected scenarios, ADO.Net system, Data, Dataset, connections, Adapters, commands, datareaders,

UNIT V

ASP.net: Introduction, Architecture, Web forms,Web servers, Server controls, Data connectivity using ASP.net, Introduction of XML, Using XML with ASP.NET


Internal marking scheme
Total :50
Attendance      Mid sem1       Midsem 2          Assignments         Tutorials
  10                    15                   15                        5                        5

========================================================================================

                                        CONCEPT NOTES

Lecture 1
Welcome students to learn Microsoft .NET in this semester . If you are keen to learn the new technology named .NET and what you can do for using this tool . This first lecture section is intended to tell you about fundamentals . After covering this section you will be ready to delve into details of .NET.

The section is divided into following sub-sections:
1) Tracing the .NET History
2) Flavors of .NET
3) Features of .NET
4) Installing .NET Framework SDK

The first sub-section will introduce you with how .NET evolved and the path of .NET
since its Beta releases.
The second sub-section will introduce you with various flavors of...NET and their respective SDKs. It also gives overview of Visual Studio.NET – an excellent IDE for developing .NET applications.
It is necessary to understand the features of .NET that make it robust, programmer friendly, powerful and flexible. The third sub-section is intended just for that. It gives overview of technical features that make .NET shine over traditional programming environments.
The final sub-section tells you how to install .NET framework SDK, what are the system requirements and related topics.


Lecture 2

Introduction to the .NET and .NET Platform
The Microsoft .NET initiative is a very wide initiative and it spans multiple Microsoft
Products ranging from the Windows OS to the Developer Tools to the Enterprise Servers.
The definition of .NET differs from context to context, and it becomes very difficult for
you to interpret the .NET strategy. This section aims at demystifying the various
terminologies behind .NET from a developer’s perspective. It will also highlight the need
for using this new .NET Platform in your applications and how .NET improves over its
previous technologies.

The driving force behind Microsoft® .NET is a shift in focus from individual Web sites
or devices to new constellations of computers, devices, and services that work together to
deliver broader, richer solutions.
The platform, technology that people use is changing. Since 1992, the client/server
environment has been in place, with people running the applications they need on the
Win32 platform, for example. Information is supplied by the databases on the servers,
and programs that are installed on the client machine determine how that information is
presented and processed.
Lecture 3

Constituents of .NET Platform
The .NET consists of the following three main parts
.NET Framework – a completely re-engineered development environment.
.NET Products – applications from MS based on the .NET platform, including
Office and Visual Studio.
.NET Services – facilitates 3rd party developers to create services on the .NET
Platform.

Understanding the various components of the .NET Platform
and the functions performed by them

Lecture 4


Common Type System Architecture
The core value types supported by the .NET platform reside within the root of the
System namespace. There types are often referred to as the .NET “Primitive Types”.
They include:
Boolean
Byte
Char
DateTime
Decimal
Double
Guid
Int16
Int32
Int64
SByte
Single
Timespan

Structure of a .NET Application

Lecture 5

Code Management

To start of with any language it’s always worth writing a simple program, which actually
does nothing but displays a “HelloWorld” string in the screen. Taking this simple
program we will try to figure out how .NET framework delivers a successful
HelloWorld.exe. Well to write such a complex program we will go for our favorite editor,
the choice is unanimous, it’s “Notepad”.


Namespace HelloWorldSample - The keyword “Namespace” is new to some
programmers who are not familiar with C++.
‘Namespace’ – a keyword in .NET is used to avoid name collisions i.e. For example, you
develop a library which has a class named “File” and you use some other library which
also has a class named “File”, in those cases there are chances of name collision. To
avoid this you can give a namespace name for your class, which should be meaningful. It
is always better to follow the syntax (MS Recommended) given below while giving
names for your namespaces

Over the course of topics covered in this session you have seen how to create a simple
HelloWorld program, to know the internals of the .NET Framework Runtime. For further
understanding or clarification you can always use the .NET framework SDK help
documentation.


Lecture 6

History of C#
.NET framework offers a myriad of languages which puts us programmers into a deep
thought process about which programming language best suits our needs.
Which language is the "best" language choice? If you are a VB wizard, should you take
the time to learn C# or continue to use VB.NET? Are C# ASP.NET pages "faster" than
VB .NET ASP.NET pages? These are questions that you may find yourself asking,
especially when you're just starting to delve into .NET. Fortunately the answer is simple:
there is no "best" language. All .NET languages use, at their root, functionality from the
set of classes provided by the .NET Framework. Therefore, everything you can do in
VB.NET you can do in C#, and vice-a-versa.


Lecture 7

Language Fundamentals in C#
Constants & Variables
Example:
int n = 10;
Object obj;
obj = n;
Explanation:
In the above code segment, a value-type variable n is declared and is assigned the value
10. The next statement declares an object-type variable obj. The last statement implicitly
performs boxing operation on the variable n.

Lecture 8
Control Statements
C# has statements such as if ….. else ….. and switch…case which help you to
conditionally execute program.
C# provides you with various looping statements, such as do… while, while, for and
foreach….in.
1. The if ….else….. Statement
The switch…case Statement.
The switch statement is a control statement that handles multiple selections by passing
control to one of the case statements within its body.

The switch uses the result of an expression to execute different set of statements.
The syntax for the select…case Statement is as follows:
switch (expression)
{
case constant-expression:
statement
jump-statement
default:
statement
jump-statement]
}

Lecture 9

for Statements.
The for loop executes a statement or a block of statements repeatedly until a specified
expression evaluates to false.
for ([initializers]; [expression]; [iterators]) statement

Example of use of for loop.
Let us see how to a write table of 2 using for loop.
for(int j = 1,i = 2; j <= 10; j++)
Debug.WriteLine("2 X " + j.ToString() + " = " + i*j );
Output:
2 X 1 = 2
..
..
..
..
..

2 X 10 = 20

Lecture 10

while…Statement
The while… Statement is used to repeat set of executable statements as long as the
condition is true.
The syntax for the while… statement is as follows:

Example print numbers from 1 to 100
int i = 1;
while ( i <= 100)
{
Debug.WriteLine(i.ToString());
i++;
}
Example print even numbers from 1 to 100
Int i = 2;
While( i <=100)
{
Debug.WriteLine(i.ToString());
i = i + 2;
}


do...while Statement
The do...while Statement is similar to while… Statement.
do
{
Statements to Execute
}
while (condition)

int i = 1;
do
{
Debug.WriteLine(i.ToString());
i++;
}while( i <= 100);
example print even numbers from 1 to 100
int i = 2;
do
{ }
while( i <= 100);

Lecture 11
Arrays
Till now we have been using variable to store values. We might come across a situation
when we might need to store multiple values of similar type. Such as names of 100
students in a school. One way to do it is to declare 100 variables and store all the names.
A much more simple and efficient way of storing these variable is using Arrays. An
Array is a memory location that is used to store multiple values.
All the values in an array are of the same type, such as int or string and are referenced by
their index or subscript number, which is the order in which these values are stored in the
array. These values are called the elements of the array.
The number of elements that an array contains is called the length of the array.
In C# all arrays are inherited from the System.Array Class.

Example 1.
We will create a C# Console Application that will accept the names of students in an
single dimension array and display it back.

Few Important methods in arrays.
GetUpperBound(), GetLowerBound() are the functions used to get the bound of a
array. These methods of the array class. You can use it with single dimension as well as
for multi-dimensional arrays.
GetLowerBound() is to get the upper limit of an array.
GetUpperBound is to get the lower limit of an array.

Lecture 12

Object Oriented Programming Concepts
Classes
One of the major problems in the earlier approach was also the data and the
functions working upon the data being separate. This leads to the necessity of
checking the type of data before operating upon the data. The first rule of the
object-oriented paradigm says that if the data and the functions acting upon the
data can go together let them be together. We can define this unit, which
contains the data and its functions together as a class.


LAB EXERCISES

Lab Assignment Guidelines

All Lab assignments will only be accepted through Lab Assignment copies :
• This should contain source code program files, one for each of the exercises assigned.
• Output of the running programs .
• You must pretest the executable files before hand to make certain they run. Any that cannot be run from clicking their icon will be automatically given a zero grade.
• Any file which isn't in ".exe" format will be given a failing grade on that particular portion of the lab (Allowed ONE source code file from VS.NET).
• Interface style counts! Make sure you title all forms and dialogs. Use proper case at all times. Watch for "dead space" on your forms. Align buttons, labels, textboxes etc. Place checkboxes and option buttons in groups, etc.
Lab Assignment 1

 In retail sales, management needs to know the average inventory figure and the turnover of merchandise. Create a project that allows the user to enter the beginning inventory, the ending inventory, and the cost of goods sold.

Form: Include labeled text boxes for the beginning inventory, the ending inventory, and the cost of goods sold. After calculating the answers, display the average inventory and the turnover formatted in text boxes.

Include buttons for Calculate, Clear, and an Exit menu choice located in a menu strip according to Windows’ standards. The formulas for the calculations are:

Average inventory = Beginning inventory + Ending inventory
2
Turnover = Cost of goods sold
Average inventory
Note: The average inventory is expressed in dollars; the turnover is the number of times the inventory turns over.

Code: Include procedures for the click event of each button. Display the results in text boxes. Format the average inventory as currency and the turnover as a number with one digit to the right of the decimal. Include error trapping (i.e., Try/Catch statements…see my sample code) which displays an error message to the user.
Test data
Beginning Ending Cost of Goods sold Average Inventory Turnover
58500 47000 400000 $52,750.00 7.6
75300 13600 515400 44,450.00 11.6
3000 19600 48000 11,300.00 4.2
LAB ASSIGNMENT 2
 A local recording studio rents its facilities for $200 per hour. Management charges only for the number of minutes used. Create a project in which the input is the name of the group and the number of minutes it used in the studio. Your program calculates the appropriate charges, accumulates the total charges for all groups, and computes the average charge and the number of groups that used the studio.

Form: Use labeled text boxes for the name of the group and the number of minutes used. The charges for the current group should be displayed formatted in a text box. Create a group box for the summary information. Inside the group box, display the total charges for all groups, the number of groups, and the average charge per group. Format all output appropriately. Include buttons for Calculate, Clear, and an Exit menu choice located in a menu strip according to Windows’ standards.

Code: Use a constant for the rental rate per hour; divide that by 60 to get the rental rate per minute. Make sure to catch any bad input data and display a message to the user (see 3_1).
Test data
Group Minutes
RadioHead 95
U2 5
Rolling Stones 480
Check Figures
Total Charges for Group Total Number of Groups Average Charge Total Charges for All Groups
$316.67 1 $316.67 $316.67
$16.67 2 $166.67 $333.33
$1600.00 3 $644.44 $1,933.33
LAB ASSIGNMENT 3
3) Create a project that calculates the total of fat, carbohydrates, and protein calories. Allow the user to enter (in text boxes) the grams of fat, the grams of carbohydrates, and the grams of protein. Each gram of fat is nine calories; a gram of protein or carbohydrates is four calories

Display the total calories for the current food items in a text box. Use two other text boxes to display an accumulated sum of the calories and a count of the items entered.

Form: The form should have three text boxes for the user to enter the grams for each category. Include labels next to each text box indicating what the user should enter. Include buttons to Calculate, to Clear the text boxes, and an Exit menu choice located in a menu strip according to Windows’ standards.

Code: Write the code for each button. Include error trapping (i.e., Try/Catch statements…see my sample code) which displays an error message to the user (See 3_1)
LAB ASSIGNMENT 4
4) Create a project that calculates the shipping charge for a package if the shipping rate is $0.12 per ounce.

Form: Use labeled text boxes for the package identification code (a six-digit code) and the weight of the package. Use one text box for pounds and another for ounces. Use a text box to display the shipping charge. Include buttons for Calculate, Clear, and an Exit menu choice located in a menu strip according to Windows’ standards.

Code: Include event-driven methods for each button click. Use a constant for the shipping rate, calculate the shipping charge, and display it formatted in a text box. Make sure to catch any bad input data and display a message to the user (see 3_1).

Hint: There are 16 ounces to a pound.
Test Data
ID Weight Shipping Charge
JK889R 0 lb. 5 oz. $0.60
BF342T 2 lb. 0 oz. $3.84
XA643L 1 lb. 1 oz. $2.04
LAB ASSIGNMENT 5
5) David McDonald, owner of McDonald’s Cut-Rate Bail Bonds, needs to calculate the amount due for setting bail. David requires the client post something of value for collateral, and his fee is 10% of the bail amount. He wants the user to have text boxes to enter the bail amount and the item being used for collateral. The program must calculate the fee.

Form: Include text boxes for entering the amount of the bail and the description of the collateral. Label each text box. Include buttons for Calculate, Clear, and an Exit menu choice located in a menu strip according to Windows’ standards. The text property of the form should read: “Dave’s Bail Bonds.”

Code: Include event-driven methods for the click event of each button. Calculate the amount due as 10% of the bail amount and display it in a text box, formatted as currency. Make sure to catch any bad input data and display a message to the user (See 3_1).

Lab Assignment 6 , 7 ,8 ,9
6) Dolly Barton owns an image consulting shop. Her clients can select from the following services at the specified regular prices: Makeover $125, Hair Styling $60, Manicure $35, and Permanent Makeup $200. She has distributed discount coupons that advertise discounts of 10 percent and 20 percent off the regular price. Create an application that will allow the receptionist to select a discount rate of 10 percent, 20 percent, or none, and then select a service. Display the price for the individual service and the total due after each visit is completed. A visit may include several services. Include buttons to Calculate, to Clear the text boxes, and an Exit menu choice located in a menu strip according to Windows’ standards.
Code: Write the code for each button. Include error trapping (i.e., Try/Catch statements…see my sample code) which displays an error message to the user.
7) Modify the prior exercise to allow for sales to additional patrons. Include buttons for Next Patron and Summary. When the receptionist clicks the Summary button, display in a summary message box the number of clients and the total dollar value for all services rendered. For Next Patron, confirm that the user wants to clear the totals for the current customer.
8) Create a program to compute your checking account balance.
Form: Include radio buttons to indicate the type of transaction: deposit, check, or service charge. A textbox will allow the user to enter the amount of the transaction. Display the new balance in a ReadOnly textbox or a label. Calculate the balance by adding deposits and subtracting service charges and checks. Include buttons to Calculate, to Clear the text box(s) (depending on your design...the read-only textbox should NOT be cleared), and an Exit menu choice located in a menu strip according to Windows’ standards. You can't allow someone to withdraw money if they don't have it in their accounts!
Code: Write the code for each button. Include error trapping (i.e., Try/Catch statements…see my sample code) which displays an error message to the user.

9) (Use “switch...case”) Piecework workers are paid by the piece. Workers who produce a greater quantity of output are often paid at a higher rate.
Form: Use textboxes to obtain the person’s name and the number of pieces completed. Include a Calculate button to display the dollar amount earned. You will need a Summary button to display the total number of pieces, the total pay, and the average pay per person. A Clear button should clear the name and the number of pieces for the current employee and a Clear All button should clear the summary totals after confirming the operation with the user.
Include validation to check for missing data. If the user clicks on the Calculate button without first entering a name and the number of pieces, display a MessageBox. Also, you need to make sure to not display a summary before any data are entered; you cannot calculate an average when no items have been calculated. You can check the number of employees in the Summary event-driven method or disable the Summary button (use the button's enable property in your code) until the first order has been calculated.
Include an Exit menu choice located in a menu strip according to Windows’ standards.

Code: Write the code for each button. Include error trapping (i.e., Try/Catch statements…see my sample code) which displays an error message to the user.

Pricing Structure
Pieces Completed Price Paid per Piece for All Pieces
1-199 .50
200-399 .55
400-599 .60
600 or more .65
10) Create an application to calculate sales for Castelano’s Catering. The program must determine the amount due for an event-driven method based on the number of guests, the menu (i.e., a food menu, not a Windows menu) selected, and the bar options. Additionally, the program maintains summary figures for multiple events.
Form: Use a textbox to input the number of guests and radio buttons to allow a selection of Prime Rib, Chicken, or Pasta. Check boxes allow the user to select an Open Bar, and/or Wine with Dinner. Display the amount due for the event in a label or a ReadOnly texbox. Include buttons to Calculate, to Clear the text box, and an Exit menu choice located in a menu strip according to Windows’ standards.
Code: Write the code for each button. Include error trapping (i.e., Try/Catch statements…see my sample code) which displays an error message to the user.

. Rates per Person
Prime Rib $25.95
Chicken $18.95
Pasta $12.95
Open Bar $25.00
Wine with dinner $8.00
Lab Assignment 11
11) Write a program which will read in the text file, Grades.txt (you'll have to remove it from the .zip file). Take each grade listed in the text file and place it in an integer array. Count how many entries there were in the text file. Then, compute the average of all the grades. The instructor has assigned a curve based on a standard deviation. Thus, the usual number to letter conversion does not apply. The grading scheme you are to use for this problem is:
91-100 = A
81-90 = B
71-80 = C
56-70 = D
0 - 55 = F
Finally, using a listbox, output each numeric score and show the letter grade in a column next to it. The first line should list the number of exams, the second line should list the Mean. Then create a column that lists the numeric score with a column listing the letter grade next to it.



1. Lectuer  Plan wikieducator.org/User:Drmksharma/lectuernotes/lplan

2. Assignments wikieducator.org/User:Drmksharma/lectuernotes/assign

3. Concept Notes / Study Material  wikieducator.org/User:Drmksharma/lectuernotes/sm


MCA Fifth Semester (Mobile Computing)

1. Lectuer Plan

2. Assignments

3. Tutorials

4. Old Year Questions (From University Papers)