Friday, May 30, 2014

Simple Bar Graph and Pie Chart


namespace SimpleBarGraph
{
    public partial class Form1 : Form
    {

Graphics Transform


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

//create metrix class
using System.Drawing.Drawing2D;

Mid Term Exam


//Car Class
namespace Zau_MidtermExam
{
    //Question No. 1
    public class Car
    {

Quiz 1


namespace Zau_CSI_154_QUIZ_1_1
{
    public partial class Form1 : Form
    {

Wednesday, May 21, 2014

Zau_Smiley Face Lab


namespace Zau_Smiley_Face
{
    public partial class Form1 : Form
    {

Thursday, May 15, 2014

Struct


namespace Structures
{

Struct_Notes

Struct
=======
A struct is a lightweight class.
Use the keyword 'struct' to define a structure.
Struct is value type, (class is reference type).

Friday, May 9, 2014

4. List of Relational Database Objects in MS Access

Objects are the types of items you can place in a database. They include:
  • Tables
  • Queries
  • Forms
  • Reports
  • Pages
  • Macros
  • Modules

CSI 156 (Database) Mid-Term Review Q.1,2,3


(1)          Three main types of data
Numbers (Numeric)
Use for data to be included in mathematical calculations, except calculations involving money (use Currency type).
Stores 1, 2, 4, or 8 bytes; stores 16 bytes for Replication ID (GUID). The FieldSize property defines the specific Number type.

More On Date / Time


namespace More_On_DateTime
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnCompareDateTime_Click(object sender, EventArgs e)
        {
            //use the > operator to compare two date
            //get user input 
            DateTime dt1 = dateTimePicker1.Value;
            DateTime dt2 = dateTimePicker2.Value;

            //compare >, <,  ==, 
            if (dt1 > dt2)
            {
                richTextBox1.Text = String.Format("{0} is most recent", dt1);
            }
            else if (dt1 < dt2)
            {
                richTextBox1.Text = String.Format("{0} is most recent", dt2);
            }
            else //must be equal
            {
                richTextBox1.Text = "Both times are equal";
            }
        }

        private void btnTimeDiff_Click(object sender, EventArgs e)
        {
            TimeSpan ts;
            //get user input 
            DateTime dt1 = dateTimePicker1.Value;
            DateTime dt2 = dateTimePicker2.Value;

            if (dt1 > dt2)
                ts = dt1 - dt2;
            else
                ts = dt2 - dt1;
           
            //Display timespan properties

            richTextBox1.Text = "Days: " + ts.Days + "\n" +
                                "Hours: " + ts.Hours + "\n" +
                                "Minutes: " + ts.Minutes + "\n" +
                                "Seconds: " + ts.Seconds + "\n\n" +
                                "TotalDays: " + ts.TotalDays + "\n" +
                                "TotalHours: " + ts.TotalHours;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //in order to work the application update
            //set maximum date inside the form load

            dateTimePicker3.MaxDate = DateTime.Now;

            //Set the min to 150 yr back from current date
            dateTimePicker3.MinDate = DateTime.Now.AddYears(-150);

        }

        private void btnGetAge_Click(object sender, EventArgs e)
        {
            TimeSpan dt = DateTime.Now - dateTimePicker3.Value;
            int years = dt.Days / 365;
            if (years > 2)
                MessageBox.Show(String.Format(
                   "you are {0} years old", years));
            else
            {
                int months = (dt.Days % 365) / 30;
                months += 12 * years;
                MessageBox.Show(String.Format(
                    "you are {0} months old", months));
            }
        }
    }
}
//To read: click here

///Lab Assignment: Add to the Person class
///Add method GetAge() to the Person class
///this method returns the numbers of years old
///
///Add method GetDaysTillBirthDay()
///this method should return the number of days 
///left until the person's birthday
///
///in form1: re-adjust the listview by adding 2 more colums: "Age", and "Days" left to brithdate
///
///Display the List<Person> with the additional information.
///
///In form1 add a method GetYoungest() that returns
///a person (the youngest person)
///add method GetOldest() that returns the oldest person
///Add button to call these methods and display.

Class with Date & Time (Lab)_Update


namespace Zau_Class_with_DateTime_Lab
{
    public class Person
    {

Tuesday, May 6, 2014

Class Containing List

namespace Class_Containing_List
{
    public class Course
    {
        //private fields

Monday, May 5, 2014

Class With Methods (Cylinder) Update


namespace Zau_Class_With_Method_Lab
{
    public partial class Form1 : Form
    {

Thursday, May 1, 2014

Class With Method_Lab (Cylinder)


namespace Zau_Class_With_Method_Lab
{

Class With Methods



namespace Class_With_Methods
{
    /// <summary>
    /// In addition to private fields, constructor, and public properties, a class may also defines methods.
    /// Methods state the functions an object of the class can perform.
    /// </summary>