15# Classes & Objects Object Oriented Programming Attributes
//////////////
//Person.cs//
//\\\\\\\\\\\
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace darklter
{
internal class Person
{
public string firstName;
public string lastName;
public char sex;
public int age;
}
}
///////////////
//Product.cs//
//\\\\\\\\\\\\
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace darklter
{
internal class Product
{
public string productName;
public string productDescription;
public float productPrice;
public int productQty;
}
}
///////////////
//Program.cs//
//\\\\\\\\\\\\
using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
Person p1 = new Person();
p1.firstName = "David";
p1.lastName = "Sdpt";
p1.age = 21;
p1.sex = 'M';
Person p2 = new Person();
p2.firstName = "Alenere";
p2.lastName = "Sdpt";
p2.age = 19;
p2.sex = 'F';
Person p3 = new Person();
p3.firstName = "Jaymar";
p3.lastName = "Catapang";
p3.age = 23;
p3.sex = 'M';
Person p4 = new Person();
p4.firstName = "Sean";
p4.lastName = "Sdpt";
p4.age = 12;
p4.sex = 'M';
Person p5 = new Person();
p5.firstName = "Patrick";
p5.lastName = "Macaraig";
p5.age = 18;
p5.sex = 'M';
Console.WriteLine(p5.firstName + " " + p5.lastName);
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////
using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
Product p1 = new Product();
p1.productName = "Milk";
p1.productDescription = "Milkyway Galaxy";
p1.productPrice = 150;
p1.productQty = 5;
Product p2 = new Product();
p2.productName = "Coke";
p2.productDescription = "1.5L";
p2.productPrice = 75;
p2.productQty = 25;
Console.WriteLine(p2.productName);
}
}
}