Tuesday, 6 May 2014

How to make a Simple Calculator in C Sharp

Full Version
This article is about a programming language.C♯ is intended to be a simple, modern, general-purpose, object-oriented programming language.

This is a simplest calculator in using c sharp language and window form that allow user to perform the six mathematical operations.the step as follows:

1-we create a window form and name is simple calculator.
2-put 17 buttons and 1 textfield.
3-change the name of the buttons.
       Labels              Names
       0                    zerobutton
       1                    onebutton
       2                    twobutton
       3                    threebutton
       4                    fourbutton
       5                    fivebutton
       6                    sixbutton
       7                    sevenbutton
       8                    eightbutton
       9                    ninebutton
       +                    plusbutton
       -                     minusbutton
       /                     dividebutton
       *                    multiplybutton
      %                    modbutton
      +/-                  plusminusbutton
      =                    equalbutton
      C                    removebutton
4- For the textbox it "output textbox"
5-When you done in your design then we see code of calculator in c#.
6- Source code of simple calculator

       using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Calculator

{
    public partial class CalcForm1 : Form
    {
        private decimal firstnumberdecimal = 0.0m;
        private decimal secondnumberdecimal = 0.0m;
        private string operatorstring = "+";
        private decimal resultdecimal = 0.0m;

        public CalcForm1()

        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)

        {

        }


        private void CalcForm1_Load(object sender, EventArgs e)

        {

        }


        private void zerobutton_Click(object sender, EventArgs e)

        {
            textBox1.Text += "0";
        }

        private void onebutton_Click(object sender, EventArgs e)

        {
            RemoveZero(1);
        }

        private void RemoveZero(int number)

        {

            if (textBox1.Text == "0")

                textBox1.Text = number.ToString();
            else
                textBox1.Text += number.ToString();
        }

        private void twobutton_Click(object sender, EventArgs e)

        {
            RemoveZero(2);
        }

        private void threebutton_Click(object sender, EventArgs e)

        {
            RemoveZero(3);
        }

        private void fourbutton_Click(object sender, EventArgs e)

        {
            RemoveZero(4);
        }

        private void fivebutton_Click(object sender, EventArgs e)

        {
            RemoveZero(5);
        }

        private void sixbutton_Click(object sender, EventArgs e)

        {
            RemoveZero(6);
        }

        private void sevenbutton_Click(object sender, EventArgs e)

        {
            RemoveZero(7);
        }

        private void eightbutton_Click(object sender, EventArgs e)

        {
            RemoveZero(8);
        }

        private void ninebutton_Click(object sender, EventArgs e)

        {
            RemoveZero(9);
        }

        private void clearbutton_Click(object sender, EventArgs e)

        {
            textBox1.Clear();
           // textBox1.Text = "";
            textBox1.Text = "0";
            firstnumberdecimal = 0.0m;
            secondnumberdecimal = 0.0m;
            resultdecimal = 0.0m;
        }

        private void button7_Click(object sender, EventArgs e)

        {
            if (!textBox1.Text.Contains("."))
            textBox1.Text += ".";
        }

        private void plusbutton_Click(object sender, EventArgs e)

        {
            supplyoperator("+");
           
        }

        private void supplyoperator(string

 _operatorstring)
        {
            operatorstring = _operatorstring;
            firstnumberdecimal = decimal.Parse(textBox1.Text);
            textBox1.Text = "0";
        }

        private void subtractbutton_Click(object sender, EventArgs e)

        {
            supplyoperator("-");
        }

        private void multyplybutton_Click(object sender, EventArgs e)

        {
            supplyoperator("*");
        }

        private void dividebutton_Click(object sender, EventArgs e)

        {
            supplyoperator("/");
        }

        private void button8_Click(object sender, EventArgs e)

        {
            secondnumberdecimal = decimal.Parse(textBox1.Text);

            switch (operatorstring)

            {
                case "+":
                    resultdecimal = firstnumberdecimal + secondnumberdecimal;
                    break;
                case "-":
                    resultdecimal = firstnumberdecimal - secondnumberdecimal;
                    break;
                case "*":
                    resultdecimal = firstnumberdecimal * secondnumberdecimal;
                    break;
                case "/":
                    resultdecimal = firstnumberdecimal / secondnumberdecimal;
                    break;
                case "%":
                    resultdecimal = firstnumberdecimal % secondnumberdecimal;
                    break;

            }

            textBox1.Text = resultdecimal.ToString();

        }


        private void plussubtractbutton_Click(object sender, EventArgs e)

        {

            if (!textBox1.Text.Contains("-"))

                textBox1.Text = "-" + textBox1.Text;
            else
                textBox1.Text = textBox1.Text.Trim('-');
        }

        private void modbutton_Click(object sender, EventArgs e)

        {
            supplyoperator("%");
        }
    }
}

7- Finally run your program and test your calculator program.
  
Full Version


Sunday, 4 May 2014

Introduction to Programming Using Python by Y. Liang


Download Now
Introduction to Programming Using Python is intended for use in the introduction to programming course.
Daniel Liang is known for his “fundamentals-first” approach to teaching programming concepts and techniques. “Fundamentals-first” means that students learn fundamental programming concepts like selection statements, loops, and functions, before moving into defining classes. Students learn basic logic and programming concepts before moving into object-oriented programming, and GUI programming.

Another aspect of Introduction to Programming Using Python is that in addition to the typical programming examples that feature games and some math, Liang gives an example or two early in the chapter that uses a simple graphic to engage the students. Rather than asking them to average 10 numbers together, they learn the concepts in the context of a fun example that generates something visually interesting.

Using the graphics examples is optional in this textbook. Turtle graphics can be used in Chapters 1-5 to introduce the fundamentals of programming and Tkinter can be used for developing comprehensive graphical user interfaces and for learning object-oriented programming.

Financial Accounting~Book B.Com Part-1

Full Version

Financial Accounting is an Important subject of modem world. That is why we bring out this book of Financial Accounting with advance methods, Practices and in a inimitable style. The students businessmen, traders, industrialists,professionals and other small level business must know financial accounting to real life situations. The book opens up the gateway of practical to the world of accounting to those who go in for the study of accounting methods and techniques academically as well as practically.
This book is useful for B.B.A,B.COM,M.Com,M.B.A,C.A,CS and IT Technologies. students and professional.

Full Version

Saturday, 3 May 2014

What is Common Language Runtime in C#?



What is Common Language Runtime in Csharp?
Today in this article I will discuss the very basic and starting topic of C# programming language because if the basics are strong then you will be survive in future of programming. It is very necessary to know that how the program compile and run in Microsoft .NET Framework let’s start it.

Introduction:
  • As part of Microsoft  .NET Framework CLR is programming(Virtual Machine component) that manages the execution of programs that is written in any language that is supported by .NET Framework e.g  C#,VB,F# etc
  • Programmers write code in any language VB,C#,F# they compile their programs into an intermediate form of code called CLI in a portable execution file(PE) that can be manage and use by CLR and then CLR converts  it into machine code then it will executed by processor.
  • The information about the environment, programming language , its version, what class libraries will be used for this code stored in the form of meta data with the compiled which tells the CLR how to handle this code.
  •  CLR allows an instance of class written in one language to call a method of class written in another language.

Got it ? or not ? I will make this more easy for you people by making the whole picture of this description.
Visualize the concept then understanding will be easy.
Diagram:


Functions of CLR:

  • Convert code in to CLI
  • Exception handling
  • Type safety
  • Memory management(using Garbage Collector)
  • Security
  • Improve performance
  • Language independency
  • Platform independency
  • Architecture independency

Components of CLR:


  •  Class Loader:
  • Used to load all classes at run time.
  • MSIL to Native code
  • It’s  JTI (just in time) compiler it will convert MSIL code into native code. 
  • Code Manager:
  • It manages the code at run time. 
  •  Garbage Collector:
  • It manages the memory. Collect all unused object and de deallocate them when the memory becomes less.
  • Thread Support:
  • It support multithreading to our application.
  • Exception Handler:
  • It handles exceptions at run time.



…END…

Friday, 2 May 2014

Advantages of Internet for Students

Full Version
Advantages of Internet for Students- zezr

The Internet provides many facilities to the people. The main advantages of Internet are discussed below.

1. Sharing Information

You can share information with other people around the world. The scientist or researchers can interact with each other to share knowledge and to get guidance etc. Sharing information through Internet is very easy, cheap and fast method.

2. News

You can get latest news of the world on the Internet. Most of the newspapers of the world are also available on the Internet. They have their websites from where you can get the latest news about the events happening in the world.

3. Searching Jobs

You can search different types of jobs all over the world, Most of the organizations/departments around the world, advertise their vacant vacancies on the Internet. The search engines are also used to search the jobs on Internet. You can apply for the required job through Internet.

4. Advertisement

Today, most of the commercial organizations advertise their product through Internet. It is very cheap and efficient way for the advertising of products. The products can be presented with attractive and beautiful way to the people around the world.

5. Communication

You can communicate with other through Internet around the world. You can talk by watching to one another; just you are talking with your friends in your drawing room.


6. Entertainment

Internet also provides different type of entertainments to the people. You can play games with other people in any part of the world. Similarly, you can see movies, listen music etc.

7. Online Education

Internet provides the facility to get online education. Many websites of different universities provide lectures and tutorials on different subjects or topics. You can also download these lectures or tutorials into your own computer. You can listen these lectures repeatedly and get a lot of knowledge. 

8. Online Results

Today, most of the universities and education boards provide results on the Internet. The students can watch their results from any part of country or world.

9. Online Airlines and Railway Schedules

Many Airline companies and Pakistan Railway provide their schedules of flights and trains respectively on the Internet.

10. Online Medical Advice

Many websites are also available on the Internet to get information about different diseases. You can consult a panel of online doctors to get advice about any medical problem. In addition, a lot of material is also available on the Internet for research in medical field.
Full Version

Inventors of Computer Hardware

Full Version
Inventers of computer hardware-zezr

Inventors of Computer Hardware: -

1:Key board— Herman Hollerith, first keypunch
devices in 1930’s
-
2:Transistor— John Bardeen, Walter Brattain & Wiliam
Shockley ( 1947-48)
-
3:RAM— An Wang and Jay Forrester (1951)
-
4:Trackball— Tom Cranston and Fred Longstaff (1952)
-
5:Hard Disk— IBM , The IBM Model 350 Disk File (1956 )
-
6:Integrated Circuit— Jack Kilby & Robert Noyce
( 1958)
-
7:Computer Mouse — Douglas Engelbart (1964)
-
8:Laser printer— Gary Starkweather at XEROX in1969.
-
9:Floppy Disk— Alan Shugart &IBM( 1970)
-
10:Microprocess­or— Faggin, Hoff & Mazor – Intel 4004 (1971)

If U Like This INformation Please Comment. Thanks 
Full Version