Monday, September 30, 2013

Operators, constants, methods, scope (1)

Here is our first program with the number of passengers per van declared as a constant. We us the modulus to return the remainder to make sure we don't leave anyone behind

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

namespace VanPoolExample
{
    class Program
    {
        //declare a constant
        const int MAXPASSENGERS = 11;

        static void Main(string[] args)
        {
            //Input
            Console.WriteLine("How many people do you need to Transport?");
            int passengers = int.Parse(Console.ReadLine());

            //Calculation
            int vans = passengers / MAXPASSENGERS;

            if (passengers % MAXPASSENGERS > 0)
            {
                vans += 1;
            }

            //output
            Console.WriteLine("You will need {0} vans", vans);

            Console.ReadKey();

        }
    }
}

Here is the cube program with methods

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

namespace methodExamples
{
    class Program
    {
        int number; //class variable class scope
        static void Main(string[] args)
        {
            Program p = new Program();
            p.GetNumber();
            
           Console.ReadKey();
        }//end main

        void GetNumber()
        {
            //input
            Console.WriteLine("enter a integer");
             number = int.Parse(Console.ReadLine());
             CalculateCube();
        }

        void CalculateCube()
        { 
           // calculation
            int cube = number * number * number;

         

            DisplayCube(cube);
        } //end calculate cube

        void DisplayCube(int cubedNumber)
        {
            //output
            Console.WriteLine("The cube of {0} is {1}", number, cubedNumber);

          
        }

    }//end class
}//end namespace

Wednesday, September 25, 2013

Statement of Work

Show Times: Local Shows and Acts

History:

It is often difficult to know where and when a local band or artist is performing. Most advertising for shows is ad hoc, consisting of bills posted on the street and small adds in free newspapers. To solve this we conceived of creating a database that would track all the local venues and shows.

Scope:

The Database will track local bands and shows. It will list the venues where the bands or artists perform. It will let fans register and be notified when an artist is playing or when a show’s act matches select genres. In order to accomplish this the database will also track artists and fans who choose to register. Artists are entered by the system administrator. Venues can enter their schedule information. Fans can self register to get notifications. Constraints:

The database will only track local artists and venues in the greater Seattle area. A local artist is one who resides mostly in the Seattle area.

Local artists will be listed but will not be allowed to add material to their information. The database will link to their homepage.

Objective:

To make it easier to locate artists and shows. To let fans receive notifications of shows that might interest them.

Schedule:

Gather information week 2
Deliverable: List of potential fields and entities
Requirements and business rules week 3
Deliverable: list of requirements and business rules
Logical Design. Week 4
Visio diagrams:
Normalization: week 5
Build the physical database add sample data
Test the database SQL
Security

Saturday, September 21, 2013

First Thoughts for Programming

Programming is difficult. It is not something you are born knowing. It is not something you usually learn when you are growing up. Programming languages are artificial. They serve to function as a bridge between human languages and machine language.

Programming languages are meant to have some of the features of human languages while maintaining the strict unambiguous logic required by computing machines.

Interestingly, computers don't understand the programming languages any better then you do at this point. A language must be complied, that is converted into the language of the machine before it can function.

Computers only understand 0's and 1's. on, off, magnetized, unmagnetized, switches open or closed. And a language must be compiled to a particular computer's processor and operating system to work.

Note: some languages, like C# or Java, do a precompile to a intermediate language that allow it to be more portable. The intermediate language is machine and Operating System neutral and can be ported to any machine. A run time (Java or .Net) then compiles the intermediate language to the actual machine.

There is usually a period of frustration when you first start programming. It seems alien and difficult and impossible. The important thing is, programming is something you can do with practice. You are smart enough. You can learn it with practice. The more you practice, the more you exercise your skills, the more you explore, the stronger your skills and instincts will grow.

You may find you like programming or you may find that you hate it, but you can learn it.

Either way it is valuable. Programming gives you a valuable insight into how computers work, and how all the things we take for granted on our computers, tablets and phones came to be.