Monday, November 24, 2014

Programming in C# (8/8) Using LINQ to Objects and XML, and Serialization


Developer and IT training videos: http://goo.gl/QBWjvA

Learn how to build websites & apps: http://goo.gl/p9DrUh

This module introduces the user on how to access databases using Language Integrated Query (LINQ). It also provides an overview of fundamentals of serialization.

Programming in C# (7/8) Interacting with the File System, and Leveraging Web Services


Developer and IT training videos: http://goo.gl/QBWjvA

Learn how to build websites & apps: http://goo.gl/p9DrUh

Why read or write to the file system? This session provides an overview about interacting with the file system and leveraging web services.

Programming in C# (6/8) Splitting Assemblies, WinMD, Diagnostics and Instrumentation


Developer and IT training videos: http://goo.gl/QBWjvA

Learn how to build websites & apps: http://goo.gl/p9DrUh

This segment provides an overview of assemblies, and how and why to share them. With all technologies it is important to measure and run diagnostics, get ready for all the demos showing you how

Programming in C# (5/8) Type and Value Validation, and Encryption Techniques


Developer and IT training videos: http://goo.gl/QBWjvA

Learn how to build websites & apps: http://goo.gl/p9DrUh

In advanced C#, you can prevent overflow, incorrect results and undesirable side-effects by validation. Let Jerry and Daren show you how to prevent security intrusions via various encryption techniques.

Programming in C# (4/8) Code Reflection and Working with Garbage Collection


Developer and IT training videos: http://goo.gl/QBWjvA

Learn how to build websites & apps: http://goo.gl/p9DrUh

This module introduces the user to code reflection and information, what this means and how to get data and create instances. It will provide an overview of garbage collection and how it works as an automatic memory management.

Programming in C# (3/8) Controlling Programmatic Flow, and Manipulating Types and Strings


Developer and IT training videos: http://goo.gl/QBWjvA

Learn how to build websites & apps: http://goo.gl/p9DrUh

This session provides an overview of controlling programmatic flow and manipulating types and strings. Don't miss this session which also includes several rich demos.

Programming in C# (2/8) Complex Types, Object Interfaces and Inheritance

Developer and IT training videos: http://goo.gl/QBWjvA

Learn how to build websites & apps: http://goo.gl/p9DrUh

In this segment the instructors go over constructing complex types and what defines the template for an object, and how reference and value imply memory strategies. They also cover object interfaces and inheritance as they relate to classes or structs.

Programming in C# (1/8) OOP, Managed Languages and C#


Developer and IT training videos: http://goo.gl/QBWjvA

Learn how to build websites & apps: http://goo.gl/p9DrUh

This module goes over the differences between Object Oriented Programming (OOP), Managed Languages and why use C# for OOP. It also addresses the evolution of C# and what you can expect with the latest version.

Thursday, November 20, 2014

Class TestBox and Box to calculate area

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyFirstConsoleApp.day2.examples
{
    class TestBox
    {
        static void Main()
        {
            Box ups, fedEx;
            ups = new Box();
            fedEx = new Box();

            ups.length = 10;
            ups.width = 5;
            double total = ups.CalculateArea(3, 4);

            fedEx.length = 7;
            fedEx.width = 5;
            total += fedEx.CalculateArea(5, 6);

            Console.WriteLine("total area = " + total);
            Console.ReadLine();
        }
    }
}
****************
************
**************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyFirstConsoleApp.day2.examples
{
    class Box
    {
        public int length;
        public int width;

        public double CalculateArea(int length, int width)
        {
            double area = length * width;
            // double area = this.length * this.width;
        Console.WriteLine("Area = " + area);
        return area;
        }
    }
}



class TestEmployee and Employee to calculate totalPay

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyFirstConsoleApp.day2.examples
{
    class TestEmployee
    {
        static void Main()
        {
            Employee alex = new Employee();
            Employee lynda = new Employee();

            alex.salary = 90000;
            alex.bonus = 20000;
            alex.CalculateTotalPay();

            lynda.salary = 100000;
            lynda.bonus = 20000;
            lynda.CalculateTotalPay();

            Console.ReadLine();
        }
    }
}






******************
***************
******************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyFirstConsoleApp.day2.examples
{
    class Employee
    {
        public double salary;
        public double bonus;

        public void CalculateTotalPay() {
            double totalPay = salary + bonus;
            Console.WriteLine("Total Pay= " + totalPay);
        }
    }
}

Best Programming Language in 2014

Article source: http://www.c-sharpcorner.com/UploadFile/mahesh/best-programming-language-in-2014/
 
So you want to know the best programming language for 2014. Well, you’ve come to the right place. In this article, you will be able to determine the best programming language in 2014.
But, before that, let’s determine what “the best” means to you.
For some people, the best programming language is the one that earns them the most money. For some it is the one that can be used to build the coolest stuff. For some, it is the language that is in high demand and can get them a job quickly. So, you need to ask yourself a question. What do you mean by “the best”? What is your goal?
Is your goal to get paid more? Or build cool stuff? Or be in high demand? Or anything else? For example, you can see COBOL is a high-paid language but it may not be in high demand. On the other hand, you can say, WordPress and PHP developers are in high demand but that may not fetch you a great paying job. So “the best” is all relative.
In this article, I will discuss various aspects of various programming languages and their demand.
Most Popular Language
If you look at the Most Popular Programming Languages over the past decade or so, you will find that C, C++ and Java are the top 3 languages. Based on the research and statistics by Udemy, TIOBE, and langpop, the following list may be used to list the top 10 most-used programming languages.
  • Java
  • C
  • C++
  • C#
  • Objective-C
  • PHP
  • Python
  • Ruby
  • SQL
  • JavaScript 
But the purpose of this article is not to talk about the Most Popular Programming Language but to determine the best programming language for you.
Most Demanding Language in 2013
Let’s have a look at the most demanding languages of 2013. ComputerWorld published a report on June 11, 2013 of the top 10 programming languages that are in demand by employers in major US cities.
Language Job Count City
SQL 98,454 New York, DC, San Francisco, Boston, Chicago
Java 66,485 New York, DC, San Jose, San Francisco, Boston
HTML 45,456 New York, DC, San Francisco, Boston, LA
JavaScript 43,189 New York, DC, San Francisco, Boston, Silicon Valley
C++ 32,018 Santa Clara, Seattle, New York, San Francisco
C# 31,936 Seattle, New York, Boston, Chicago, Atlanta
XML 31,431 DC, New York, San Francisco, Boston, Atlanta
C 24,801 Santa Clara, Seattle, New York, San Francisco, San Diego
Perl 20,579 San Jose, New York, Seattle, San Francisco, Boston
Python 19,627 Mountain View, San Francisco, New York, Seattle, Boston
Structured Query Language (SQL) may not be a fully functional programming language but has been in demand more than any other language in year 2013. And it is very obvious due to data processing and demand. The demand of a language changes from year to year and from city to city. As you can see from the preceding table, C# language is in most demand in Seattle. The reason is obvious. Microsoft is the biggest employer in Seattle area. Similarly, if you look at the last item in the preceding table, Python is the most demanded language in Mountain View. So it all depends on the location, the project type and the interest. If your interest is in working with a mobile startup, you may not find C or C# attractive compare to Objective-C or if your goal is to make more money, C# may be the way to go.
Best Paid Language
Programmers’ salaries usually depend on several factors such as the location, experience, skills, and company. For example, Juniper Networks in the same city pays a lot more than Microsoft for same experience and skillset.
Let’s refer to a list ComputerWorld published on June 11, 2013 on the top 10 most paid programming languages in major US cities.
Language Average Salary City
Java $95,000 New York, DC, San Jose, an Francisco, Boston
C++ $94,000 Santa Clara, Seattle, New York, San Francisco
C $93,000 Santa Clara, Seattle, New York, San Francisco, San Diego
Perl $93,000 San Jose, New York, Seattle, San Francisco, Boston
XML $92,000 DC, New York, San Francisco, Boston, Atlanta
C# $91,000 Seattle, New York, Boston, Chicago, Atlanta
SQL $90,000 New York, DC, San Francisco, Boston, Chicago
     
JavaScript $88,000 New York, DC, San Francisco, Boston, Silicon Valley
Python $83,000 Mountain View, San Francisco, New York, Seattle, Boston
HTML $81,000 New York, DC, San Francisco, Boston, LA
As you can see from the preceding table, Java is the best-paid language. But it does not mean that you can’t make more money in C#. There may be some companies that may pay more to a C# developer than a Java developer. For example, in the Philadelphia area, there is high demand of senior .NET developers, they can earn pretty much more than an average salary. It also depends on how badly a company needs a skilled developer.
Most Exciting Language
So you like excitement? Excitement is all about building cool and cutting-edge solutions. Today, Mobile, Big Data, and Cloud are in very much demand.
 
Mobile development was the most demanding skillset in 2013. As you can see from the stats published by StatCounter, Android leads all the mobile platforms followed by iOS. Obviously, Java and Objective-C will be the most demanding languages for the mobile development.
Most Versatile Language
Out of the preceding listed programming languages C, C++, Java and C#, probably the most versatile among them all are C++ and C#. Using C#, you can develop Windows client applications, Web applications, components, Windows Store apps, Windows Phone app, Enterprise, and even iOS and Android mobile applications. The details of this topic I will cover in my next article titled, What C# can do for you. Stay tuned!
Conclusion
The best programming language is all relative to you. It depends on what your goal is. In this article, we talked about various aspects of programming languages. Clearly, Mobile, Big Data, Wearable and Cloud are the leading trends for 2014. It will be interesting to see where 2014 goes from here. I hope you liked this article. I definitely would love to hear what your take is on this article as well as some programming languages you may have used.

Wednesday, November 19, 2014

calculate tax

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TextHello.TaxCal
{
    class TaxExercise
    {
        static void Main()
        {
            System.Console.WriteLine("Enter salary!");
            string input = System.Console.ReadLine();
            double salary = System.Convert.ToDouble(input);
            double tax;
            if (salary <= 8350.0)
            {
                tax = 8350.0 * 0.10;
            }
            else if (salary <= 33950.0)
            {
                tax = ( 8350.0 * 0.10 ) + ((salary - 8350.0) * .15);
            }
            else
            {
                tax = ( 8350.0 * 0.10 ) + ((33950 - 8350.0) * .15) + ((salary - 33950.0) * .25);
                System.Console.WriteLine("salary=" + salary);
               
            }
            System.Console.WriteLine("tax= " + tax);
            System.Console.ReadLine();
        }
    }
}

for while and or switch case array text

//using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TextHello
{
    class Program
    {
        // Hellow world program
        static void Main(string[] args)
        {
            System.Console.WriteLine("Hello World");
            int x = 10;
            int y = 3;
            int result = x % y;
            System.Console.WriteLine("result =" + result);
            System.Console.WriteLine("{0} + {1} = {2}", x, y, (x + y));
            System.Console.ReadLine();
            // for loop
            for (int i = 10; i >= 0; i--)
            {
                System.Console.WriteLine("i=" + i);
            }
            // while loop
            int ix = 10;
            while (ix >= 0)
            {
                System.Console.WriteLine("ix =" + ix);
                ix--; // ix = ix-1;
            }
            // do while loop
            // executes at least one line
            int iy = 10;
            do
            {
                System.Console.WriteLine("iy =" + iy);
                iy--;
            } while (iy > 0);
            // and or statemnet
            // short and &&  or || vs. regular and &  or |
            // shorts ones don't check the second arg once the first arg is satisfied.
            // regular ones always checks every arg in bracket
            System.Console.WriteLine("-------------- and or statement && ||");
            x = -10;
            y = 10;
            if (x >= 0 && y >= 0)
            {
                System.Console.WriteLine("both numbers positive");
            }
            else if (x >= 0 || y >= 0)
            {
                System.Console.WriteLine("at least one number positive");
            }
            else
            {
                System.Console.WriteLine("both numbers negative");
            }
            // switch case
            System.Console.WriteLine("----------- switch case");
            string j = "Two";
            switch (j)
            {

                case "Zero":
                    System.Console.WriteLine("value is 0");
                    break;
                case "One":
                    System.Console.WriteLine("value is 1");
                    break;
                case "Two":
                    System.Console.WriteLine("value is 2");
                    break;
                case "Three":
                    System.Console.WriteLine("value is 3");
                    break;
                default:
                    System.Console.WriteLine("value not found");
                    break;

            }
            //
            // declare array
            //
            System.Console.WriteLine("--------------- array manipulation");
            int[] a = { 10, 20, 30, 40, 50, 60};
            System.Console.WriteLine(a[3]);
            a[4] = 55;
            System.Console.WriteLine(a[4]);
            for (int i = 0; i < a.Length; i++ )
            {
                System.Console.WriteLine("a["+i+"] ="+ a[i]);
            }
            foreach (int tempvar in a)
            {
                System.Console.WriteLine(tempvar);
            }
            // initialize array and then assign values
            System.Console.WriteLine("---------- assign array values");
            int[] xx = new int[6];
            xx[0] = 10;
            xx[3] = 50;
            foreach (int z in xx)
            {
                System.Console.WriteLine(z);
            }
            // manipulate text
            System.Console.WriteLine("----------- manipulate text");
            string c = "David Beckham";
            System.Console.WriteLine("Hello " + c);
            System.Console.WriteLine(c.ToUpper()); // DAVID BECKHAM
            System.Console.WriteLine(c.Substring(2));//vid Beckham
            System.Console.WriteLine(c.Substring(4,5));//d Bec
            System.Console.WriteLine(c.IndexOf("v"));//2
            System.Console.WriteLine(c[1]);//a
            // text array
            string[] cy = {"one", "two", "three" };
            foreach (string z in cy)
            {
                System.Console.WriteLine(z);
            }
            // change text to number
            System.Console.WriteLine("--------  change text to number");
            string age = "34";
            string sal = "8743784.71";
            int g = System.Convert.ToInt32(age);
            System.Console.WriteLine("g/2= " + g/2);
            System.Console.WriteLine("sal*0.02= " + System.Convert.ToDouble(sal)* .02);


            // End of program
            System.Console.ReadLine();


        }
    }
}

Tuesday, November 18, 2014

Functions

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("type any number!");
            ConsoleKeyInfo keyInfo = Console.ReadKey();

            PrintFooToScreen100Times();

            //if (keyInfo.KeyChar == "a")
            //  {
            //   Console.WriteLine("That's not a number!");
            //  }
            //else
            //{
            Console.WriteLine("Did you type {0}", keyInfo.KeyChar.ToString());
            //}
        }
            /// Functions
            static void PrintFooToScreen()
            {
            Console.WriteLine("Foo");
            }
            /// Functions
            static void PrintFooToScreen100Times()
            {
            for (int counter=0; counter <= 100; counter++)
            {
            PrintFooToScreen();
            }
            }

       
    }
}

Friday, November 14, 2014

Object Oriented Programming OOP


Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which are data structures that contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. A distinguishing feature of objects is that an object's procedures can access and often modify the data fields of the object with which they are associated (objects have a notion of "this"). In object-oriented programming, computer programs are designed by making them out of objects that interact with one another.[1][2] There is significant diversity in object-oriented programming, but most popular languages are class-based, meaning that objects are instances of classes, which typically also determines their type.

Many of the most widely used programming languages are multi-paradigm programming languages that support object-oriented programming to a greater or lesser degree, typically in combination with imperative, procedural programming. Significant object-oriented languages include C++, Objective-C, Smalltalk, Delphi, Java, JavaScript, C#, Perl, Python, Ruby and PHP.
 (from wikipedia)

Thursday, November 13, 2014

Simple Calculator

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace calculator
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("**** Simple Calculator ****");
            // 1st number
            Console.WriteLine("Enter first number");
            int num1 = Convert.ToInt16(Console.ReadLine());
            // second number
            Console.WriteLine("Enter second number");
            int num2 = Convert.ToInt16(Console.ReadLine());
            // operations
            Console.WriteLine("Enter operation");
            string opt = Console.ReadLine();
            int result = 0;
            // if condition
            if (opt ==  "+")
            {
                result = num1 + num2;
            }
            else if (opt == "-")
            {
                result = num1 - num2;
            }
            else if (opt == "*")
            {
                result = num1 * num2;
            }
            else if (opt == "/")
            {
                result = num1 / num2;
            }
            Console.WriteLine("The result is ***   " + result);
            Console.ReadLine();
        }
    }
}

C# Beginner Code practice

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp20141113
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter your last name");
            string SomeDatafromUser = Console.ReadLine();
            try
            {
                if (SomeDatafromUser.Length > 10)
                {
                    throw new Exception("Name should not be greater than 10 characters");
                }
                Console.WriteLine("Hello " + SomeDatafromUser);
                Console.WriteLine("hello again");
                Console.ReadLine();
                Console.WriteLine("Enter your age");
                int Age = 0;
                Age = Convert.ToInt16(Console.ReadLine());
                Console.WriteLine("Hello Mr " +SomeDatafromUser+" your age is "+ Age );
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
                Console.ReadLine();
            }
        }
    }
}