Monday, September 29, 2014

Basic numbers and operators

Here is what we did in class

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

namespace NumberExample
{
    class Program
    {
        /* ************************
         * this program is just an example of using
         * numeric types, specifically int and double
         * and the basic math operators
         * steve conger 9/29/2014 Evening class
         * **********************/
        static void Main(string[] args)
        {
            //declaring an int. You can declare several
            //variables at once as long as they are the same
            //type.
            int number, numberb, numberc;
            double number2; //a double has decimal places
            const double PI =3.14; //a constant can't be changed
            //constants are all caps by convention.

            Console.WriteLine("Enter an Integer");
            //everything entered on the console is a string
            //(true also of textboxes) and must be Parsed
            //or converted to the numeric type--in this case int
            number = int.Parse(Console.ReadLine());
            //another way to convert string to int
            //number = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter another integer");
            numberb = int.Parse(Console.ReadLine());
            
            /**************************
             * operators
             * ***********************/

            //addition
            numberc = number + numberb;
            Console.WriteLine("{0} + {1} = {2}", number, numberb, numberc);

            //subtraction
            numberc = number - numberb;
            Console.WriteLine("{0} - {1} = {2}", number, numberb, numberc);

            //multiplication
            numberc = number * numberb;
            Console.WriteLine("{0} * {1} = {2}", number, numberb, numberc);

            //Integer division. In integer division only a whole number is returned 
            //5/2=2 Any remainder or decimal part is dropped
            numberc = number / numberb;
            Console.WriteLine("{0} / {1} = {2}", number, numberb, numberc);

            //Modulus
            //for integers the modulus % returns the remainder in an integer
            //division 5%2=1 because 5/2 = 2 with a remainder of 1
            numberc = number % numberb;
            Console.WriteLine("{0} % {1} = {2}", number, numberb, numberc);

            //doubles need to be parsed as a double
            Console.WriteLine("Enter a double");
            number2 = double.Parse(Console.ReadLine());


            //this will still result in 5/2=2 becuase the division is still between two
            //integers
            number2 = number / numberb;
            Console.WriteLine("{0} % {1} = {2}", number, numberb, number2);

            //if you want the result to be a double you have to "Cast" one side of
            //the division to a double. (double)number does that.
            number2 = (double)number / numberb;
            Console.WriteLine("{0} % {1} = {2}", number, numberb, number2);

            //The Math library is a static library that is always available.
            //just type Math and a dot to see the available
            Console.WriteLine(Math.Sqrt(number2));

            //Pause for Visual Studio
            Console.ReadKey();
        }
    }
}

Statement of Work: Book Reviews

History

Several people have been reviewing books over the years and want to consolidate their reviews into a database. They have posted in various web sites but want to bring it all together. They want to make it easier to post reviews, compare them and search for items of interest. They also want to avoid some of the “trolling” and abusive reviews that mar most sites. They are hoping that by only allowing registered members to review and comment on reviews they can minimize some of that.

The database will be a back end to a web site. They intend to hire separate developers to create the front end. They would love to see their database and site become a major draw for book lovers of all kinds.

Scope:

The database will store data about books, the reviewers, reviews and commentaries on reviews. Only registered reviewers can post reviews and commentary, but anyone can search and read reviews. There should be many ways to search for reviews and books. Each review will contain a numerical rating for the book as well as text.

Constraints:

The database will not be expanded to include other media such as music and film.

Objectives

1. Create a database to store book reviews
2. Make the database easily searchable
3. Minimize abusive and irrelevant reviews

Time line and deliverables

1. Gather information, interviews. (One week)

Deliverables: interview questions, questionnaire.

2. Establish requirements and business rules (One Week)

Deliverables: List of Requirements, business rules.

3. Design the database. ERD diagrams (One Week)

Deliverables: Entity Relation Diagram with all Entities, Attributes and relationships.

4. Review the design for normalization. (One Week)

Deliverables: Normalized ERD. List of changes with reasons

5. Build the physical database (0ne Week)

Deliverables: Database with tables and relationships

6. Enter sample Data and Test the database (One Week)

Deliverables: Sample Data. SQL queries on requirements with results

7. Refine security and other elements (One Week)

Deliverables: Security Plan. Disaster Management Plan.

Wednesday, September 24, 2014

First Exercise Assignment1

Here is the first exercise of assignment 1

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

namespace Assignment1
{
    class Program
    {
        /**********************
         * this is for assignment1
         * Part 1 entering name and email
         * Steve Conger 9/24/2014
         ***********************/
        static void Main(string[] args)
        {
            //declare variables
            string firstName;
            string lastName;
            string email;

            //get input
            Console.WriteLine("Enter your first name");
            firstName = Console.ReadLine();
            Console.WriteLine("Enter your last name");
            lastName = Console.ReadLine();
            Console.WriteLine("Enter your email");
            email = Console.ReadLine();

            //display output
            Console.WriteLine("{0}, {1}--{2}", lastName, firstName, email);
            Console.WriteLine(lastName + ", " + firstName + "--" + email);

            Console.ReadKey();
        }
    }
}